M
mikebres
I have a module that is supposed to open a dynaset from a table based
on a parameter. However I get an empty recordset. Here is the section
of the code where the problem occurs:
Dim db As DAO.Database
Dim rstLetter As DAO.Recordset, rstLO As DAO.Recordset
.....
Set db = CurrentDb
Set rstLetter = db.OpenRecordset("SELECT Data.facility, Data.oper,
Data.ScanDT, Data.postnet,Data.planetcode, Data.machine, Data.idtag
FROM Data
WHERE Data.planetcode='" & MyPC & "' ORDER BY Data.ScanDT")
Set rstLO = db.OpenRecordset("tblLetterObject", dbOpenDynaset)
'fill the variables
With rstLetter
.MoveFirst
The variable MYPC is passed to the subroutine. I copied the select
statement into a query and tried it, and it worked fine. So I'm at a
loss. Does anybody have an idea what I'm doing
wrong?
Thanks
Mike
on a parameter. However I get an empty recordset. Here is the section
of the code where the problem occurs:
Dim db As DAO.Database
Dim rstLetter As DAO.Recordset, rstLO As DAO.Recordset
.....
Set db = CurrentDb
Set rstLetter = db.OpenRecordset("SELECT Data.facility, Data.oper,
Data.ScanDT, Data.postnet,Data.planetcode, Data.machine, Data.idtag
FROM Data
WHERE Data.planetcode='" & MyPC & "' ORDER BY Data.ScanDT")
Set rstLO = db.OpenRecordset("tblLetterObject", dbOpenDynaset)
'fill the variables
With rstLetter
.MoveFirst
The variable MYPC is passed to the subroutine. I copied the select
statement into a query and tried it, and it worked fine. So I'm at a
loss. Does anybody have an idea what I'm doing
wrong?
Thanks
Mike