Help! Order by (SQL)

schu7044

Registered User.
Local time
Today, 07:20
Joined
Jan 31, 2008
Messages
14
I am attempting to sue an SQL statement to filter a query. I am using this statement:

strSQL = "SELECT * FROM qryGroup WHERE Left([TxGroup],3) = " & strGroup & " AND ActiveInGroup = True" & ORDER BY [SSAN];

Everything works until I try to use the "Order By" criteria (this is where I get a syntax error.

I am giving the user the option of sorting several different ways and I don't want to make 5 different queries.

Can anyone help?

Don
 
It looks like your query should be


strSQL = "SELECT * FROM qryGroup WHERE Left([TxGroup],3) = " & strGroup & " AND ActiveInGroup = True ORDER BY [SSAN];"
 
It looks like your query should be
strSQL = "SELECT * FROM qryGroup WHERE Left([TxGroup],3) = '" & strGroup & "' AND ActiveInGroup = True ORDER BY [SSAN];"
 

Users who are viewing this thread

Back
Top Bottom