I have the following SQL code from a working Access Query. I'm going to want to run about eight very similar queries with one button click and so rather than having to have all of these queries defined I want to run the SQL code in VBA, but I can't get it to work due to not knowing how to convert the syntax properly. This is the SQL code:
UPDATE [Product Sales] SET [Product Sales].[Quantity Sold] = [forms]![Gift Set Converter]![BathSaltsSample]+Nz(DLookUp("[Quantity Sold]","Product Sales","[SalesReportDate]=forms![Gift Set Converter]![Report Date] and [Product]='Bath Salts (Sample)'"),0), [Product Sales].Revenue = [forms]![Gift Set Converter]![BathSaltsSampleRev]+Nz(DLookUp("[Revenue]","Product Sales","[SalesReportDate]=forms![Gift Set Converter]![Report Date] and [Product]='Bath Salts (Sample)'"),0)
WHERE ((([Product Sales].SalesReportDate)=[Forms]![Gift Set Converter]![Report Date]) AND (([Product Sales].Product)="Bath Salts (Sample)"));
Thanks.
UPDATE [Product Sales] SET [Product Sales].[Quantity Sold] = [forms]![Gift Set Converter]![BathSaltsSample]+Nz(DLookUp("[Quantity Sold]","Product Sales","[SalesReportDate]=forms![Gift Set Converter]![Report Date] and [Product]='Bath Salts (Sample)'"),0), [Product Sales].Revenue = [forms]![Gift Set Converter]![BathSaltsSampleRev]+Nz(DLookUp("[Revenue]","Product Sales","[SalesReportDate]=forms![Gift Set Converter]![Report Date] and [Product]='Bath Salts (Sample)'"),0)
WHERE ((([Product Sales].SalesReportDate)=[Forms]![Gift Set Converter]![Report Date]) AND (([Product Sales].Product)="Bath Salts (Sample)"));
Thanks.