Why "no current record" on a DLookup function?

Why "no current record" on a DLookup function?

Post by Laure » Sun, 30 Jul 2006 09:33:03


This is the first line of a function that I execute repeatedly throughout my
app. But now I have a situation where it is giving me a "no current record"
error. How could that be with this line? The context is that I have a form
that collects data and then opens a report. If I close the report and then
re-execute the form, to print another report, I get the "No current
record..." error at this line. I'm mystified. Will appreciate any help.

ls_firstname = DLookup("First_Name", "tblStudents", "[student_id] = " &
ai_StudentID)
 
 
 

Why "no current record" on a DLookup function?

Post by Douglas J. » Sun, 30 Jul 2006 21:39:59

What is "ai_StudentID"?

--
Doug Steele, Microsoft Access MVP
http://www.yqcomputer.com/
(no private e-mails, please)

 
 
 

Why "no current record" on a DLookup function?

Post by Laure » Sun, 30 Jul 2006 23:56:10

That was it. The function was being called by the report. I had this in
one of the header text items: =fncStudentName([student_id]).
The second time I ran the report I was adding the current day, and so there
were no records for the report. I'll add a check.

The truly weird thing, though, was that even when I hovered over ai_student
with the mouse in the de *** , I would get that "no current record" error.
You'd think the function would just treat it as a null. How did it know why
the value wasn't good???

Thanks for helping me see the obvious.