I am trying to create a run time query based on a bunch of check-boxes in the form. I have a static number of columns to be selected and i can regenerate the where clause as i go, this would really save me a bunch of time.
I am running into 2/3 issues here.
1. I am really new creating run time queries so i dont how to execute them.
2. Secondly after execution how display the results in a datasheet of access.
Here is code which i have written so far, i can figure out how the above two things:
Private Sub Command127_Click()
Dim fsqlst, sqlst, wherecl, condtion As String
Dim rs As DAO.Recordset
Dim db As DAO.Database
sqlst = "SELECT MasterPipe.Client, MasterPipe.Region, MasterPipe.[Deal Name], MasterPipe.[Client Type], MasterPipe.Market, MasterPipe.[Sales/RM/Meeting Owner], MasterPipe.[Proj Type], MasterPipe.DocumentLocation, MasterPipe.[Assets (MM) Millions], MasterPipe.[Est Rev (M) Thousands], MasterPipe.Priority, MasterPipe.CKC, MasterPipe.Consultant FROM MasterPipe"
If USCustody.Value = True Then
wherecl = " WHERE (((MasterPipe.[US Custody])=" & "'X'" & ")" & " Or (MasterPipe.[US Custody])=" & "'x'" & ");"
fsqlst = sqlst & wherecl
'Set rs = CurrentDb
'Set db = CurrentDb