Re: Syntax error

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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"
> >
>
>
>
.



Relevant Pages

  • Re: Syntax error
    ... >I am running the code below but keep getting syntax error. ... > Dim rs As New ADODB.Recordset ... > Dim str As String ... > MsgBox nMeet ...
    (microsoft.public.access.modulesdaovba)
  • Syntax error
    ... Paul ... Dim rs As New ADODB.Recordset ... Dim str As String ... MsgBox nMeet ...
    (microsoft.public.access.modulesdaovba)
  • Re: Convert Access 2 to Access 2000
    ... Decl statements that reference DLL's will need to be re-written. ... > "Brendan Reynolds" wrote in message ... >> GlobalSign digital certificate is a forgery and should be deleted without ... >>>> Dim ThisPlayer As Long ...
    (microsoft.public.access.conversion)
  • Re: How can I get Atributes from the field of the table via VBA
    ... I think is data type in code ... "Brendan Reynolds" wrote: ... I don't know how you could get the caption and format, ... Dim tdf As DAO.TableDef ...
    (microsoft.public.access.adp.sqlserver)
  • Re: ADO Recordset Seek Method ?
    ... perhaps someone with more experience of SQL Server might answer ... > "Brendan Reynolds" wrote in message ... Access 97 format does not support Seek Method. ... Dim rstEmployees As ADODB.Recordset ...
    (microsoft.public.data.ado)