I’m developing an Excel macro to pull records from an Access database. I using VBA to execute a query with SQL. The problem is that it is returning more records than expected. I only want records where
- The account is 2150
- The Deposit_Ref doesn’t contain ADJ
- The Deposit_Ref doesn’t contain 0.00
- The Sub_Date is not null
- The Upload_Date is not null
Here is the SQL used in the query:
"SELECT [Grp], [Cust_Name], [CS_Date], [AR_Amt], [Amt_Paid], [Acct], [Unit_Num], [Deposit_Ref], [Sub_eEmpl], [Sub_Date] FROM [AR Data] WHERE ([AR Data].Acct='2150') AND (([AR Data].Deposit_Ref Not Like '*ADJ*') And ([AR Data].Deposit_Ref Not Like '* 0.00*')) AND ([AR Data].Sub_Date Is Not Null) AND ([AR Data].Upload_Date Is Null)"
I’m using Office 2016 and Windows 10. Any suggestions to modify the SQL would be greatly appreciated. Thanks for the help….