DLookUp value doesn't change

upsman

Registered User.
Local time
Today, 16:53
Joined
Jul 22, 2005
Messages
26
I have a report based on a query. The query joins the Students table to the Schedules table based on Student-Id. The Schedules table also contains the student's classes. I have another query that joins the Schedules table to the Courses table by Class-Id. I use this query in a DLookUp for the field in the report to print the class description. The DLookUp is coded like this:
=DLookUp("[ClassDesc]","ClassDesc1"). This works fine, I get the description on the report. But the problem is, the description never changes for each student.
All the students have the same description(s) print on the report; it's printing the 1st students class description for every student. The descriptions should be changing as each student changes to reflect each students classes. How do I get it to change for each student?

Thanks,
Rod
 
upsman said:
The DLookUp is coded like this:
=DLookUp("[ClassDesc]","ClassDesc1"). This works fine, I get the description on the report. But the problem is, the description never changes for each student.

Rod,

Take a closer look at the on-line Help for DLookUp. You have not specified a Criteria.

From AC97 OnLine Help...."Although criteria is an optional argument, if you don't supply a value for criteria, the DLookup function returns a random value in the domain."

You'll need to construct a criteria string that includes passing the changing value (variable) you want to look-up against in order to get the description.

Alternately, could you not just include the table in the query that is the report's record source, and then include that field in the report (without having to use a DLookUp)?

Regards

John.
 

Users who are viewing this thread

Back
Top Bottom