simple question but no answer on any access forum!

T

Thanatosuk

I have two tables, table 1 and table 2 (i'll keep this in simple english).
Table 1 contains contact details of customers while table two, contains the
ID No of the customer from the customer's table and the name from the
customers table, plus a load of other info entered by the user as the table
is filled (both tables are filled through simple forms). Now, here is my
problem.

When the user is filling in table 2 from its form, I would like to, after
the name is entered, have the ID No auto entered (as its value is in the ID
No in the customers table1) into the ID No field in table 2.
not one of the Access books i have, have read or consulted show how to do
this!
and if it's posible do i use a macro, expression or code to do it?
 
D

Duane Hookom

This is most easily handled by using a main form bound to table1 and a
subform bound to table2. You set the link master/child properties to the ID
(primary key) field. This will automatically pass the ID value from the main
form to the subform.
 
D

Dirk Goldgar

Thanatosuk said:
I have two tables, table 1 and table 2 (i'll keep this in simple english).
Table 1 contains contact details of customers while table two, contains
the
ID No of the customer from the customer's table and the name from the
customers table, plus a load of other info entered by the user as the
table
is filled (both tables are filled through simple forms). Now, here is my
problem.

When the user is filling in table 2 from its form, I would like to, after
the name is entered, have the ID No auto entered (as its value is in the
ID
No in the customers table1) into the ID No field in table 2.
not one of the Access books i have, have read or consulted show how to do
this!
and if it's posible do i use a macro, expression or code to do it?


Table 2 should not contain the name from the customers table, only the
customer ID. However, on the form for table 2, the Customer ID field should
be represented by a combo box whose rowsource is a query of the Customers
table. The query would return both ID and name, probably sorted by name.
The combo box would have these properties:

Column Count: 2
Column Widths: 0'; 2" (maybe)
Bound Column: 1
Control Source: CustomerID

(although the specific field name depends on what you named it in your
table.)

With this arrangement, the user will see and select customer names, but what
gets stored in the table is the ID.
 
R

russ yahoo account

If the forms are bound to the table, set the relationship between the two up
via parent and child fields and it would auto-update elseif the forms and
fields are not bound to any table or query, simply set the id field of form2
to the value of the id field of form1 as soon as any field on form2 is
updated.
 

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