
December 15th, 2004, 02:04 PM
|
|
Registered User
|
|
Join Date: Dec 2004
Posts: 16
Time spent in forums: 4 h 36 m 16 sec
Reputation Power: 0
|
|
|
Syntax Error - Query from Newbie
I hope this is something simple. I am new so just hacking away here but I'm stuck.
I just want to filter my results first by the OfficeID and then if they are authorised. Here is the code:
Code:
'Initalise the strSQL variable with an SQL statement to query the database by selecting all tables ordered by the decending date
strSQL = "SELECT " & strDbTable & "Comments.* " & _
"FROM " & strDbTable & "Comments "
strSQL = strSQL & "WHERE "& strDBTable & "Comments.OfficeID = 1 "
If strDatabaseType = "SQLServer" Then
strSQL = strSQL & "WHERE " & strDbTable & "Comments.Authorised = 1 "
Else
strSQL = strSQL & "WHERE " & strDbTable & "Comments.Authorised = true "
End If
strSQL = strSQL & "ORDER BY Date_stamp DESC;"
'Set the cursor type property of the record set to dynamic so we can naviagate through the record set
rsCommon.CursorType = 3
'Query the database
rsCommon.Open strSQL, adoCon
Here is my error message:
Code:
Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error (missing operator) in query expression 'tblGBComments.OfficeID = 1 WHERE tblGBComments.Authorised = true'.
Any help is appreciated! Thanks.
|