referring similar tables toward
RH

Forum home » Delegate support and help forum » Microsoft Access Training and help » Referring to similar tables toward a common goal | Access forum

Referring to similar tables toward a common goal | Access forum

resolvedResolved · Medium Priority · Version 2002/XP

Joe has attended:
Access Intermediate course

Referring to similar tables toward a common goal

Dear Best STL

(Please see accompanying screen shots sent in email to info@stl-training.co.uk)

My database has groups of related tables, where each group is specific to a certain kind of contact. Some examples include:
Stores group (Stores_group.gif) - names of stores with their employees and related information (addresses, emails, tel. numbers etc)
Press group (Press_group.gif) - names of press houses (Elle, Vogue etc) with their employees and related information (addresses, emails, tel. numbers etc)
Contacts group (Contacts_group.gif) - names of people, associated company (if any) and related information (addresses, emails, tel. numbers etc)

Up until now, through my lack of Access knowledge, these groups have been pretty much used in isolation. This situation has to change, as apart from being inefficient (the groups could share the same report to make delivery lists, for example) it's got to a silly situation regarding orders of our products. Nearly all our sales are made to stores (Stores_related_tables_with_orders.gif), but someone working for a magazine (in the press group), may want to order a product; as could someone from the contacts group, or any other group. Up until now a person who is not part of the stores group, is added to this group, so I can process their order and create the necessary documents. This leads to two identical bits of information being used in the database, which I know is not good, apart from wasting my time because I have to copy contact information from one group into the stores group.

My question is, how can I refer to information kept in different tables so I can create orders for everybody entered in the database in whatever group they exist? Presumably a query is needed for the job, but how when the ID AutoNumber could be the same for two different contacts from two different groups.

Note 1: If you see any errors or improvements to be made in my table relationships, I'd of course be happy to hear them.
Note 2: Many other tables (with mostly one-to-one relationships) have been deleted from the screen shots for clarity.

Many thanks ... oh yes, and Happy New Year!
Joe

RE: Referring to similar tables toward a common goal

Hi Joe

Happy new year to you too!

I've created a simple example to test your question.
I have 4 tables
TblOrders
TblContacts
TblStores
TblPress

The aim was to create a query that draws in information from all the tables depending on which type of Contact_ID is used.

Because the Contact_Id doesn't identify the contact I've added a new field called Contact_Type (either, Contact, Press or Stores) to TblOrders

Then a IIF statement can be used to pick up the correct Contact names and other info.

I hope this helps you find a way. Another might be to put all contacts into 1 table with the Contact_Type field there instead.

I've attached my example as a zip file.

Regards
Doug Dunn
Best STL




Attached files...

ForumOrdersExample.zip

RE: Referring to similar tables toward a common goal

Dear Doug

Many thanks for your answer and example, it looks promising.

Unfortunately I’ve discovered a serious error in my database (for which I’ve posted another question) and have to resolve this before I can apply and test your example.

I will get back to you once these issues are solved.
Best regards.
Joe

Will be marked as resolved in 5 days

Notice: This is an automated message. Due to inactivity, this forum post will be marked as 'resolved' if there are no further responses in the next 5 days.

Mon 19 Jan 2015: Automatically marked as resolved.


 

Access tip:

Create An Inaccessible Field On A Form

There is sometimes a need to make a field in a form look like a normal field but be completely inaccessible to the user. To do this:

In the Field's Properties
Set the ENABLED property to No
Set the LOCKED property to Yes

The field will not grey out, but the user will not be able to do anything with it.

View all Access hints and tips


Server loaded in 0.05 secs.