cpopham Posted December 22, 2004 Posted December 22, 2004 It has been a while since I have done this. I know that when you want to use a text variable in your SQL statement you can do something like this: strSQL = "SELECT * FROM myTable WHERE ID=" & myVariable & " ORDER BY myorder;" Now my questions are as follows: 1) Is the above SQL statement correct for use against an access database using a string variable? If not what would be correct? 2) Is the above SQL statement correct for using a numeric variable? If not what would be correct? 3) Is the above SQL statement correct for using a date variable? If not what would be the correct format? It has been a while and I can not remember the correct way of doing it. Thanks, Chester Quote ____________________________________________ http://www.pophamcafe.com I am starting a developers section, more tutorials than anything.
pendragon Posted December 23, 2004 Posted December 23, 2004 The SQL Statements would be 1) strSQL = "SELECT * FROM myTable WHERE String = '" & myVariable & "' ORDER BY myorder" 2) strSQL = "SELECT * FROM myTable WHERE Number = " & myVariable & " ORDER BY myorder" 3) strSQL = "SELECT * FROM myTable WHERE Date = DateValue('" & myVariable & "') ORDER BY myorder" Hope This Helps Quote
cpopham Posted December 23, 2004 Author Posted December 23, 2004 Thanks for the help. It has been a while and it is hard to keep them all straight. Chester Quote ____________________________________________ http://www.pophamcafe.com I am starting a developers section, more tutorials than anything.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.