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.
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.