Printing field from another table

upsman

Registered User.
Local time
Today, 09:40
Joined
Jul 22, 2005
Messages
26
I would like to print a field from another table on a report. The table the report is based upon is Schedules. Using a field from Schedules, I'd like to read another table and print a field from that table. In the Control Source of my report field I thought I could enter an SQL statment similiar to "Select Courses.Desc WHERE Schedules.ClassId = Courses.ClassId" but that didn't work. It said I had syntax errors and wouldn't accept the statement. I want to print Courses.Desc using the ClassId as the key to read the table.

I also tried setting up a query that joined Schedules to Courses based on the ClassId and the report field's Control Source looks like this:
=[Courses Query]![ClassDesc]
When I try to preview the report, an "Enter Parameter Value" box comes up asking for "Courses Query".

I'm new to Access so I haven't gotten VBA down yet but I just need a simple SQL statement or something to retrieve the field from the other table so it will print on my report. I have several fields on the report I need to do this for so I will just be duplicating the code and/or query using different names.

Thanks,
Rod
 
Someone suggested I try DLookup to get the value so I coded
=DLookUp("[ClassDesc]","Courses","[ClassId] = " & [Schedules]![ClassId1])
into the ControlSource field but when I preview the report an Enter Parameter Value box pops up and asks for Schedules. Any ideas as far as that goes?

I do have a query coded but I have 8 courses and 8 teachers for those courses in one record in the Schedules table. So for my query, I have the main Schedules table and joined to that I have 8 Courses tables (Course1,Course2,...) and 8 Teachers tables (Teacher1, Teacher2,...). I have 16 tables joined to the one Schedules table. When I run the query it runs fine, but when I run the report, which is based on the query, it hangs if I have more than 22-25 records in the Schedules table. If I delete some records the report works fine but so far 25 records has been my max. Is there anyway I can debug what is happening when the report is running? I'm just guessing the the query is my problem, I really have no idea why I can print more than 25 records. Any suggestions?
 
upsman,

[Schedules]![ClassId1] should probably be --> Forms![Schedules]![ClassId1]

Wayne
 

Users who are viewing this thread

Back
Top Bottom