G
graeme34 via AccessMonster.com
I am trying to embed the following query into my code:
strSQL = "SELECT * " _
& "FROM tblDespatch " _
& "WHERE SalesOrderNumber = " & lngOrderNum & ";"
Set rsDes = CurrentDb.OpenRecordset(strSQL, _
dbOpenDynaset)
It works fine, with this being a simple query it looks quite tidy. But when I
experimented to try and tied it up with the following:
strSELECT = "SELECT *"
strFROM = "FROM tblDespatch"
strWHERE = "WHERE SalesOrderNumber =" & lngOrderNum & ";"
strSQL = strSELECT & strFROM & strWHERE
It failed, could somebody please advise the correct syntax please.
strSQL = "SELECT * " _
& "FROM tblDespatch " _
& "WHERE SalesOrderNumber = " & lngOrderNum & ";"
Set rsDes = CurrentDb.OpenRecordset(strSQL, _
dbOpenDynaset)
It works fine, with this being a simple query it looks quite tidy. But when I
experimented to try and tied it up with the following:
strSELECT = "SELECT *"
strFROM = "FROM tblDespatch"
strWHERE = "WHERE SalesOrderNumber =" & lngOrderNum & ";"
strSQL = strSELECT & strFROM & strWHERE
It failed, could somebody please advise the correct syntax please.