How to Create Table Relationships in VBA

G

Guest

Hello,

This is my first post and I would be grateful for any help! I am writing
some VBA code to initialize a report (using Access 2002, ADO). The report is
based on a query with multiple tables. One table needs to be dynamically
joined to another table using VBA before I open the report. Is there an easy
way to do this? It seems like there should be but I can't find any help on
this at all.

(FYI: The reason the table needs to be joined using code is that it is
created by a summary query which may be grouped by different fields, as
requested by the user. Thus the "group by" field needs to be linked to any
one of several fields in the query, depending on which field is being
summarized.)

Thank you in advance for any help!
 
S

SusanV

Sure - use a SQL JOIN, for example:

SELECT DISTINCTROW [Last Name], [First Name]
FROM tblCustomers INNER JOIN tblInvoices
ON tblCustomers.CustomerID = tblInvoices.CustomerID
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top