RE: Syntax Error - Missing Operator - When Using Date !
- From: Clinton <Clinton@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 24 Mar 2006 03:11:01 -0800
The value for the Name parameter in the WHERE clause needs to be enclosed
with single quotes:
Where Name='SomeName'
And, depending on the local, you may have problems with the Date format when
the user setting for the Date seperator in the control panal is not in US
format (such as a period as a date part seperator as in 01.01.2006).
So, use the following instead:
Format$(PickDate.List(PickDate.ListIndex), "mm\/dd\/yyyy")
Using "\" forces the Format function to use "/"
or better use the ISO 8601 format:
Format$(PickDate.List(PickDate.ListIndex), "yyyy-mm-dd")
"lovely_angel_for_you@xxxxxxxxx" wrote:
Hi,.
I have this query to pull the data out from the system. And whenever I
run this, I get the "Syntax Error (Missing Operator)" Error displayed.
Set conn = New ADODB.Connection
FilePath = App.Path & "\Calls.mdb"
With conn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "Data Source=" & FilePath & ";"
.Open
End With
'Set rdset = New ADODB.Recordset
'The following is single string, it just gets wrapped up.
Set rdset = conn.Execute("SELECT * FROM InputData Where Name=" &
Name.Text & " AND DateNow=#" &
Format$(PickDate.List(PickDate.ListIndex), "mm/dd/yyyy") & "#")
'And then I get to use the data here.
rdset.Close
conn.Close
Any help on the above will be greatly appreciated.
Thanks & Regards
Harnek Singh
- References:
- Syntax Error - Missing Operator - When Using Date !
- From: lovely_angel_for_you
- Syntax Error - Missing Operator - When Using Date !
- Prev by Date: Questions on combo box and MSFlexGrid
- Next by Date: Re: Syntax Error - Missing Operator - When Using Date !
- Previous by thread: Syntax Error - Missing Operator - When Using Date !
- Next by thread: Syntax Error - Missing Operator - When Using Date !
- Index(es):
Relevant Pages
|