Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

One form - two tables 2

Status
Not open for further replies.

pradh

Technical User
Oct 29, 2004
9
US
HI,

I have a form where the controls get populated from two tables, "main-table" (all records)& "dim-table" (default dimensions of a product) based on a combobox selection. Once the form is filled with default values from table 2, the user still can change these values to create a new record in main table.

Is there a way to connect the value of a textbox in a form to a field in a different table.

Any help in putting the concept in to a form is appreciated.

Thank you,
Pradh
 
Take a look at the DLookUp function.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
You would do it from code use the code behind the form and per haps the onupdate event. At the time you finish updating the form, and are moving off or doing something that will fire the event, you have code in the event to add the data to another table.

The problem is, how do the other fields in that table get updated?
 
Here is the way its arranged
I have 2 Tables - "Table1", "Table2"

Table1 has fields "Size", "dim"

Table2 has same fields "Size" and "dim" but these are default dimension of the product.

CustomOrderForm has a combobox "cmbSize" and textBox "dim"

On choosing size from combobox, the default "dim" from Table2 will be populated in textbox.

After seeing the default "dim" user can type a different number to create custom order record in Table1


Thank you for the reply.
 
In the AfterUpdate event procedure of the combo you may have something like this:
Me![name of dim textbox] = DLookUp("dim", "Table2", "Size='" & Me!cmbSize & "'")
If Size is defined as numeric in Table2 then get rid of the single quotes.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top