Re: Syntax error
- From: "Paul" <Paul@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 11 Sep 2005 03:23:01 -0700
Brendan
I did have the statement,(statement at the end of post), with that change
in, but it includes all the records prior to the "from" date. What i am
trying to acheive is to get the records between the two dates
ta
Paul
"Brendan Reynolds" wrote:
> 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: RoyVidar
- Re: Syntax error
- References:
- Syntax error
- From: Paul
- Re: Syntax error
- From: Brendan Reynolds
- Syntax error
- Prev by Date: Re: replaceall function error
- Next by Date: Re: Syntax error
- Previous by thread: Re: Syntax error
- Next by thread: Re: Syntax error
- Index(es):
Relevant Pages
|