How to Change criteria on a saved query using VBA


Joined
Sep 19, 2016
Messages
1
Reaction score
0
Hello,
I have this saved query:
SELECT tblFullRecords.GroupID, tblFullRecords.DistrictID, tblFullRecords.Names, tblFullRecords.GENDER, tblFullRecords.Designation, tblFullRecords.DateOfReg
FROM tblFullRecords
WHERE (((tblFullRecords.GENDER)="male") AND ((tblFullRecords.Designation)="member") AND ((tblFullRecords.DateOfReg)="day 1"));
(I just copied the SQL string from the object directly)

Now I need to change the criteria : tblFullREcords.DateOfReg = "day 1" to pick up the value of a control cboSelectDay in my form each time the code runs. I could use expression builder but I need to use VBA code to allow for other variables in the project. So, how can I achieve this using VBA codes?

There are five other five queries I need to carry out this same procedures on. Rather than work with saved queries, is there a way I can dynamically create and alter these queries in VBA?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top