Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automate Generic Conversion of SQL

Status
Not open for further replies.

AlanJordan

Programmer
Sep 15, 2005
139
US
Does anyone know of a way to develop a query in Access, and then change the SQL of the query so that it includes variables. The result would be a SQL statement like this:
Code:
   qdfText = "SELECT KKLogin2Justifications.KKLoginID, KKLogin2Justifications.DateAdj, KKLogin2Justifications.Reason," & _
   "KKLogin2Justifications.AdjustmentMadeBy, KKLogin2Justifications.AdjustmentNumber" & _
   " FROM KKLogin2Justifications WHERE (((KKLogin2Justifications.KKLoginID)=" & Chr(34) & strKKLogin & _
   Chr(34) & ") AND " & _
   " ((KKLogin2Justifications.DateAdj) Between " & _
   "#" & Me!cboBegDate.Value & "# And #" & Me!txtEndingDate.Value & "#));"

Thanks,
Alan
 
You may create a parametized query and then play with the Parameters collection of the QueryDef object in VBA.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
That's a thought. When I'm off deadline, I'll give it a try.

Alan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top