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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update form from another table

Status
Not open for further replies.

longhair

MIS
Feb 7, 2001
889
US
Hi all,

I'm somewhat new to Access & any help would be appreciated.
Keyword search is down, so please excuse me if there has been a solution posted.
I have a form & would like to update info in it from another table based on an entry in a field of the form.
What I have is table1.field, .field2, .field3, etc. & form1.field1, .field2, .field3, etc. Upon entering data in form1.field1 I would like to set (update) form1.field2 (etc) = table1.field2 where form1.field1 = table1.field1.
form1 is an entry form for table2.
I would like to accomplish this in VB code if possible but any solution would be greatly appreciated.

Thank you in advance.
Dave
 
are you saying that you want users to select a value identifying a record from a combo then for the rest of the fields for that record to display on the form?

if so what you need to to is use a sub form.

Create a form with all the fields that you want to display (plus a hidden Field1 field). Then create a second form with an unbound combo box that you are going to use to select the record to view. Insert the first form into the second as a sub form and set the linkparent property and linkchild property for the subform control to the combobox control name and the Field1 control on the subform.

Now, when you select a field using the combobox, the corresponding record will be displayed in the subform. If you don't want your users to be able to edit values in the table, simply set the AllowEdits Form property in the subform to No.

I hope this answers you question.


 
I'm not sure if your solution will put me on the correct path for what is needed down the road:
Table1 is a customer header table. Table2 is a service table(detail). Table1 primary key is field1. Table1 to table2 is a one to many relationship. The three fields I want from table1 on form2 and in table2 are first name, last name & customer type. Customer type is going to be used to calculate data in other fields in form2 - ie if customer type = "monthly" then next service date = service date + 30. This last part I already know how to structure the code, I'm just having an issue automatically populating fields in this form, from another table, based on last name.

Thank you in advance.

Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top