query needed to pull like records from two tables

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to create a report that would pull all of a student's attendance
records together to print when they leave our continuing education program.
The problem seems to be that each of two tables; one for current enrolment
records, and the other for records in courses completed, share like field
names. Thus when you run the query, you get an error message when the second
field of like name runs indicating such. Is there a way I could alias the
field names in one table for the query or would it be best to use a
subform/subreport? I've tried the subreport option, but cannot get the two
sets of results to organize cronologically as is needed. If it were possible,
I think solving the problem at the query level would be better.

Thanks in advance for any help in this matter.
 
When you specify a field in a query, it should allow you to specify the
table as well.

You can do the same in your reports. You just need to fully declare the
name of the field you wish to pull.

If this data is to be put together with noe regard to which table it came
from, I would build a union query to pull all the matching records from both
tables into one query.

Rick B
 
Rick B said:
If this data is to be put together with noe regard to which table it came
from, I would build a union query to pull all the matching records from both
tables into one query.

Thank you for your prompt reply, Rick. I have tried this and it is when I
run the query to combine the two tables that I get the error message
indicating that the field is duplicated.

By what (forgive my ignorance) do you mean "union query"? I have created a
query that uses both tables in the design and created a relationship on the
student ID field to join them. I have put the necessary fields on the
grid...name, course, teacher, etc. and then added the week number and the
hours fields from both tables. It indicates which table they are from in the
design grid, but still I get the error.
 
Use the help file to look at Union queries. It will pull records from two
like tables to create one list of matching records.



B. Meincke said:
Rick B said:
If this data is to be put together with noe regard to which table it came
from, I would build a union query to pull all the matching records from both
tables into one query.

Thank you for your prompt reply, Rick. I have tried this and it is when I
run the query to combine the two tables that I get the error message
indicating that the field is duplicated.

By what (forgive my ignorance) do you mean "union query"? I have created a
query that uses both tables in the design and created a relationship on the
student ID field to join them. I have put the necessary fields on the
grid...name, course, teacher, etc. and then added the week number and the
hours fields from both tables. It indicates which table they are from in the
design grid, but still I get the error.
 
Back
Top