J
Jack G
I'm trying to set up a continuous form such that clicking on the heading
will sort on that field. I set up the following code for the click event:
Private Sub ProjectNumberHeading_Click()
Dim strSQL As String
strSQL = "SELECT MainQuery.[ProjectNumber], MainQuery.[ClientName],
MainQuery.[ProjectName] " & _
"FROM MainQuery " & _
"ORDER BY MainQuery.[ProjectNumber];"
'Debug.Print strSQL
DoCmd.RunSQL strSQL
ProjectNumberHeading.FontBold = True
End Sub
But it doesn't work - the error message keeps saying:
"Run-time error '2342':
A RunSQL action requires an argument consisting of an SQL statement"
I've checked, double-checked and triple-checked, and can't see what's wrong.
I've printed the value of strSQL into the Immediate Window, pasted it into
the SQL view of a query, and it works fine that way. Can anyone see my
stupid mistake?
Thanks,
Jack
will sort on that field. I set up the following code for the click event:
Private Sub ProjectNumberHeading_Click()
Dim strSQL As String
strSQL = "SELECT MainQuery.[ProjectNumber], MainQuery.[ClientName],
MainQuery.[ProjectName] " & _
"FROM MainQuery " & _
"ORDER BY MainQuery.[ProjectNumber];"
'Debug.Print strSQL
DoCmd.RunSQL strSQL
ProjectNumberHeading.FontBold = True
End Sub
But it doesn't work - the error message keeps saying:
"Run-time error '2342':
A RunSQL action requires an argument consisting of an SQL statement"
I've checked, double-checked and triple-checked, and can't see what's wrong.
I've printed the value of strSQL into the Immediate Window, pasted it into
the SQL view of a query, and it works fine that way. Can anyone see my
stupid mistake?
Thanks,
Jack