98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel VBA Training and help » SQL statement - syntax for filtering by multiple fields
SQL statement - syntax for filtering by multiple fields
Resolved · Urgent Priority · Version 2003
Rob has attended:
Excel VBA Advanced course
SQL statement - syntax for filtering by multiple fields
I am trying to build a sheet from a Access table using the SQL stement and using more than one filter...my proposed line of code is...
Const SQL As String = _
"SELECT CompanyCode, AccountCode, CentreCode, Level3Code, YTD_Ccy FROM tblPvtLink WHERE CompanyCode = 'MAINCO' & CentreCode = '7380' , '7302' ORDER BY AccountCode"
Where have I gone wrong with the filtering syntax?
Cheers
Rob
RE: SQL statement - syntax for filtering by multiple fields
I should have used the AND OR functions here...
But for some reason when I try and filter out zero balances by adding YTD_Ccy <> 0 it doesn't work, unless it is the only filter criteria...please advise
Cheers
Rob
RE: SQL statement - syntax for filtering by multiple fields
Hi Rob
Thanks for the question
Can you clarify for me whether the YTD field contains a value that is entered into a table, or whether it is the result of a calculation in a query?
Thanks
Stephen
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Highlighting a data rangeAttempting to use a mouse to highlight a large range of cells with data in Excel can make the mouse to have a life of it's own! |