simple question but no answer on any access forum!

  • Follow


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?



0
Reply Utf 4/30/2010 7:07:01 PM

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.
-- 
Duane Hookom
Microsoft Access MVP


"Thanatosuk" wrote:

> 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?
> 
> 
> 
0
Reply Utf 4/30/2010 7:26:06 PM


"Thanatosuk" <Thanatosuk@discussions.microsoft.com> wrote in message 
news:6A666E87-1560-412D-928B-3832DF4D3A4A@microsoft.com...
>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.

-- 
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

0
Reply Dirk 4/30/2010 7:30:09 PM

test
"Thanatosuk" <Thanatosuk@discussions.microsoft.com> wrote in message 
news:6A666E87-1560-412D-928B-3832DF4D3A4A@microsoft.com...
>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?
>
>
> 

0
Reply russ 4/30/2010 9:35:47 PM

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.

"Thanatosuk" <Thanatosuk@discussions.microsoft.com> wrote in message 
news:6A666E87-1560-412D-928B-3832DF4D3A4A@microsoft.com...
>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?
>
>
> 

0
Reply russ 4/30/2010 9:41:48 PM

4 Replies
275 Views

(page loaded in 0.065 seconds)

Similiar Articles:
















7/16/2012 5:39:43 PM


Reply: