reason being there is no space for your joined string and that created an syntax error
>> Set rsBooked = "SELECT ID FROM tblBooked" & "ORDER BY [ID] ASC"
Gustav Brock
Why not simply:
Set rsBooked = "SELECT ID FROM tblBooked ORDER BY [ID] ASC"
or:
Set rsBooked = "SELECT ID FROM tblBooked ORDER BY 1"
/gustav
Dale Fye
everyone is focusing on the SQL, except Rgonzo.
1. you have to define the SQL correctly, Rgonzo did this although I cannot understand at all why anybody feels the need to define the SQL string by separating the SELECT and Order By clauses:
strSQL = "SELECT ID FROM tblBooked ORDER BY ID"
2. The second is that cannot open a recordset by setting a value to a string.
set rsBooked = currentdb.OpenRecordset(strSQL, , dbfailonerror)
>> Set rsBooked = "SELECT ID FROM tblBooked" & "ORDER BY [ID] ASC"