Set Value in subform - beginner!

hugh0177

Registered User.
Local time
Today, 14:50
Joined
Jun 23, 2003
Messages
14
Hi

I have a form with a subform, and the subform is actually an intermediary form/table in a many to many relationship with another table/form.
For user-friendly-ness the intermediary form/table includes not only foriegn keys, but the titles of institutions that are assigned that primary/foriegn key (yes, the information is a little redundant because this information is in also in both of the tables connected to the intermediary table).
I want some kind of command button or marco/expression to attatch to a field to automatically fill in the name of the institution when I have filled in the foriegn keys.
I am trying to use a marco because I don't know much in VBA.
Is this possible with macros?
If I have to use VBA I might just fill everything in manually... :(
thanks
K
 
K,

You can use the DLookUp function to fill in the fields. There
are plenty of examples if you use the search facility here.

Wayne
 
You don't need code at all if you learn how to use SQL. Create a query that joins the main table to the lookup table on the appropriate field. Select the columns you need from BOTH tables. Then use the query as the recordsource for the form. You will be able to select all the columns you need from the field list and place them on the form.

Using queries that join to the lookup tables is good technique and much faster than DLookup().
 

Users who are viewing this thread

Back
Top Bottom