G
Guest
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"
"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"