Question : access change Dlookup to recordset

I have the following code:
JobID = GetID() 'get jobID number to fill in batch fields
JobNum = DLookup("JobNumTN", "JobsDoors", "[ID] =" & JobID)
JobSuf = DLookup("JobSuffix", "JobsDoors", "ID =" & JobID)
JobBat = DLookup("BatchNum", "JobsDoors", "ID =" & JobID)
JobDrs = DLookup("Doors", "qryOpenJobsDoors", "[ID] =" & JobID)

I would like to ues a recordset ==> This is what I have tried:
Dim rst As DAO.Recordset

Set rst = CurrentDb.OpenRecordset ("SELECT * FROM JobsDoors WHERE [ID] = JobId)
JobNum = rst!JobNumTN
JobSuf = rst!JobSuffix
JobBat = rst!BatchNum
rst.Close
Set rst = Nothing

I am having trouble getting the criteria to work and I need to open another recordset for the JobDrs value I need.

Any suggestions?

Thanks,


Answer : access change Dlookup to recordset

Dim rst As DAO.Recordset
JobID = GetID()
Set rst = CurrentDb.OpenRecordset ("SELECT * FROM JobsDoors WHERE [ID] = " & JobId)
JobNum = rst!JobNumTN
JobSuf = rst!JobSuffix
JobBat = rst!BatchNum
rst.Close
Set rst = Nothing


or

Dim rst As DAO.Recordset

Set rst = CurrentDb.OpenRecordset ("SELECT * FROM JobsDoors WHERE [ID] = " & GetID())
JobNum = rst!JobNumTN
JobSuf = rst!JobSuffix
JobBat = rst!BatchNum
rst.Close
Set rst = Nothing

Random Solutions  
 
programming4us programming4us