chestera
asked on
ORDER BY
Hi EE
I have the following and a mental block
Set rsBooked = "SELECT ID FROM tblBooked" & "ORDER BY [ID] ASC"
Not working where have I gone wrong. Any help appreiated
chestera
I have the following and a mental block
Set rsBooked = "SELECT ID FROM tblBooked" & "ORDER BY [ID] ASC"
Not working where have I gone wrong. Any help appreiated
chestera
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Why not simply:
Set rsBooked = "SELECT ID FROM tblBooked ORDER BY [ID] ASC"
or:
Set rsBooked = "SELECT ID FROM tblBooked ORDER BY 1"
/gustav
Set rsBooked = "SELECT ID FROM tblBooked ORDER BY [ID] ASC"
or:
Set rsBooked = "SELECT ID FROM tblBooked ORDER BY 1"
/gustav
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(st rSQL, , dbfailonerror)
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(st
ASKER
Gustav Brock
Getting same error as with my example Compile error Type mismatch. Tried Ryans version same result
Alan
Getting same error as with my example Compile error Type mismatch. Tried Ryans version same result
Alan
ASKER
Dale Fye
You are correct just tried Rgonzo 1971 and it worked. Thank you for your comment
Alan
You are correct just tried Rgonzo 1971 and it worked. Thank you for your comment
Alan
ASKER
Thank your all for your help
>> Set rsBooked = "SELECT ID FROM tblBooked" & "ORDER BY [ID] ASC"