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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text field instead of Numeric doesn't work 1

Status
Not open for further replies.

teqtaq

Technical User
Nov 18, 2007
197
US
I am trying to execute code which worked just fine when field was a numeric.
I had to change it to a text and now it is not giving me a correct result:


Set dbs = CurrentDb

strDel = "DELETE * FROM TBL"
dbs.Execute strDel, dbFailOnError

strSQL1 = "SELECT DISTINCT ID FROM TBL"
Set rst1 = dbs.OpenRecordset(strSQL1, dbOpenForwardOnly)
Do While Not rst1.EOF

strSQL2 = "SELECT * FROM TBL WHERE ID =" & rst1.ID & " ORDER BY Date"
_____________________________________________________
rst1.ID is taking 0001 value when it has to be "0001"

Please, help.
 
strSQL2 = "SELECT * FROM TBL WHERE ID =""" & rst1.ID & """ ORDER BY Date"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top