
Help needed with SQL (runtime Error 91)
Hi,
I have a piece of code - in Access 97 - that goes and queries some tables
for documents edited by someone...it works but when I try to change the SQL
so that it will find documents edited between 2 dates, I get runtime error
91
(Object variable or With block variable not set). My help file is in
Japanese and I'm not able to follow it. Any help would be great. (Code is
below)
Thanks in advance,
John
The code that works
-----------------
sSQL = "SELECT Documents.ID, Title, Description, DocEditHist.Document FROM
DocEditHist INNER JOIN Documents ON DocEditHist.Document = Documents.ID
WHERE DocEditHist.EditedBy=" & Me!SelectItList.Column(2) & " ORDER BY
Title;"
Set qdQuery = dbThisDB.CreateQueryDef("qryWhat", sSQL)
Set rsThisRS = qdQuery.OpenRecordset(dbOpenSnapshot, dbReadOnly)
The changed SQL that causes the problem
------------------------------------
sSQL = "SELECT Documents.ID, Title, Documents.Description,
DocEditHist.Document FROM DocEditHist INNER JOIN Documents ON
DocEditHist.Document = Documents.ID WHERE DocEditHist.EditDate>=" & X & "
AND DocEditHist.EditDate<=" & Y & " ORDER BY Title;"