Re: Syntax error
- From: "Brendan Reynolds" <brenreyn@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 11 Sep 2005 10:45:05 +0100
Where you have ...
And <=
.... you should have ...
And tblMMD.DateOfMeeting <=
--
Brendan Reynolds (MVP)
"Paul" <Paul@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:4FC8E952-05A1-48B6-B9FE-F852FDDAB336@xxxxxxxxxxxxxxxx
>I am running the code below but keep getting syntax error.
>
> "from" and "to" are date fields on my form holding the dates used for the
> criteria
>
> help appreciated
>
> Paul
>
>
> Dim rs As New ADODB.Recordset
> Dim cn As ADODB.Connection
> Dim str As String
>
> Set cn = CurrentProject.Connection
> Set rs = New ADODB.Recordset
>
>
> str = "SELECT tblMMD.mmdID,tblMMD.DateOfMeeting FROM tblMMD WHERE
> (((tblMMD.DateOfMeeting) >= #" + From + "# And <= #" + To + "#))ORDER BY
> tblMMD.DateOfMeeting"
>
> rs.Open str, cn, adOpenStatic, adLockOptimistic
> nMeet = rs.RecordCount
>
> MsgBox nMeet
>
> etc
>
> this does work but does not give the correct record count total:
>
> str = "SELECT tblMMD.mmdID,tblMMD.DateOfMeeting FROM tblMMD WHERE
> (((tblMMD.DateOfMeeting) >= #" + From + "# And (tblMMD.DateOfMeeting) <=
> #" +
> To + "#))ORDER BY tblMMD.DateOfMeeting"
>
.
- Follow-Ups:
- Re: Syntax error
- From: Paul
- Re: Syntax error
- References:
- Syntax error
- From: Paul
- Syntax error
- Prev by Date: Re: referencing a form control
- Next by Date: Re: replaceall function error
- Previous by thread: Syntax error
- Next by thread: Re: Syntax error
- Index(es):
Relevant Pages
|