D
Duck
I am trying to define an variable to hold an SQL query and am having
all sorts of trouble when I open a recordset with the variable.
The original query is:
SELECT tblTimes.ID, tblTimes.UserName, tblTimes.TimeIn,
tblTimes.TimeOutLunch, tblTimes.TimeInLunch, tblTimes.TimeOut,
tblTimes.MiscOut, tblTimes.MiscIn
FROM tblTimes
WHERE (((tblTimes.TimeIn) Like CDate(Format(Date(),"mm/dd/yyyy")) &
"*"));
My vaiable definition looks like this:
strSql = "SELECT tblTimes.ID, tblTimes.UserName, tblTimes.TimeIn,"
strSql = strSql & " tblTimes.TimeOutLunch, tblTimes.TimeInLunch,"
strSql = strSql & " tblTimes.TimeOut, tblTimes.MiscOut,
tblTimes.MiscIn"
strSql = strSql & " FROM tblTimes"
strSql = strSql & " WHERE (((tblTimes.TimeIn)"
strSql = strSql & " Like CDate(Format(Date(),"mm/dd/yyyy")) &
"*"))"
rs.open strSql, cnn, adOpenDynamic, adLockOptimistic
I know the problem centers around the double quotes in the last line,
and I have tried all sort of variations to try to resolve the problem
to no avail...when I remove the WHERE clause the query works fine, but
with the clause I get an EOF or BOF error message, which I pretty sure
indicates that there are no records being returned for the recordset.
Can anyobdy help me PLEASE!!
all sorts of trouble when I open a recordset with the variable.
The original query is:
SELECT tblTimes.ID, tblTimes.UserName, tblTimes.TimeIn,
tblTimes.TimeOutLunch, tblTimes.TimeInLunch, tblTimes.TimeOut,
tblTimes.MiscOut, tblTimes.MiscIn
FROM tblTimes
WHERE (((tblTimes.TimeIn) Like CDate(Format(Date(),"mm/dd/yyyy")) &
"*"));
My vaiable definition looks like this:
strSql = "SELECT tblTimes.ID, tblTimes.UserName, tblTimes.TimeIn,"
strSql = strSql & " tblTimes.TimeOutLunch, tblTimes.TimeInLunch,"
strSql = strSql & " tblTimes.TimeOut, tblTimes.MiscOut,
tblTimes.MiscIn"
strSql = strSql & " FROM tblTimes"
strSql = strSql & " WHERE (((tblTimes.TimeIn)"
strSql = strSql & " Like CDate(Format(Date(),"mm/dd/yyyy")) &
"*"))"
rs.open strSql, cnn, adOpenDynamic, adLockOptimistic
I know the problem centers around the double quotes in the last line,
and I have tried all sort of variations to try to resolve the problem
to no avail...when I remove the WHERE clause the query works fine, but
with the clause I get an EOF or BOF error message, which I pretty sure
indicates that there are no records being returned for the recordset.
Can anyobdy help me PLEASE!!