Sql query / VBA - multiple Select / where conditions problem
I'm sorry if this has been answered already, but I couldn't find the right solution for my problem.
I have an excel file with user form where users can insert exchange rates and diferent parameters for financial report.
I've set up a DB file and I want to select rows based on the values in BV column (book value) and it should be higher than 100.000EUR The problem is that I have 3 other currencies besides EUR and I need to calculate EUR amount based on exchange rate.
I've already made exchange rate field in my user form (BVAL is EUR default, and I also have BVGBP, BVPLN and BVRSD, which are 100.000EUR divided with each exchange rate) This works fine:
SqlQuery = " SELECT * FROM Sheet1 where (bv>=" & BVAL & " and Currency = 'EUR')";"
But when I try to combine multiple results,syntax is not working, I've tried a lot of other solutions I've found online, but I cannot seem to get it working.
SqlQuery = " SELECT * FROM Sheet1 where (bv>=" & BVAL & " and Currency='EUR') or (bv>=" & BVGBP & " and Currency='GBP') _
or (bv>=" & BVPLN & " and Currency='PLN') or (bv>=" & BVRSD & " and Currency='RSD');"
I would appreciate it if you could give me suggestions how to fix this, I'm quite new to VBA and I don't mind to google solutions, but this one is tough :). Thanks!
from Recent Questions - Stack Overflow https://ift.tt/39tS3OO
https://ift.tt/eA8V8J
Comments
Post a Comment