Default Values Into Table from Another

feinj

OracLegend
Local time
Today, 04:03
Joined
Oct 17, 2007
Messages
42
Hello all. I am so frustrated. I have been trying to find a solution to this problem for days.

What I am trying to do is default values into a primary table when select a primary key value in another table. Both the primary and secondary table have a field called "Cust_ID". The primary table is for Customer Returns and the secondary table is for Customer Addresses. I want to select a Customer from the Customer Addresses Table and have all the address detail populate the same fields in the Customer Returns table. Fields to be populated are address1, address2, address3, address4, City, State, ZIP, Country. Etc.

Both tables contain these fields.

The reason I must populate the Customer Returns table with this data is because the record must be kept intact as recorded, regardless of changes to the Customer Address Table Data over time.

Is there anyone out there that can help me please.
 
Thanks for the response pbaldy. I tried the solution you provided in your HTML which was the last option on the page. However, it is not working. The solution I refer to is below:

If your situation is that rare one where saving the related info is necessary, you'd use the same combo. In the textbox, instead of the formula as the control source, you'd list the field in the Orders table where you wanted the phone number saved. In the after update event of the combo, you'd have code like this to copy the value over:

Me.TextboxName = Me.ComboName.Column(2)

I tried to create the event procedure within the combo box of the Data Entry Form. should it be within a combo box of the Orders Table?

Also, is there a small sample database available that I can refer to as a source?
 
It would be behind the combo you use to select a customer. I don't have a sample of that built. If you're still stuck, you can post your db here and we can try to fix it.
 
I am posting a scrubbed version of the DB here. Please see what you can do to fix. I want to automatically update the "PSR Header Tbl" for the fields below when I select the "CustomerID" in the "PSR Header Data Entry Form".

Fields for Update:
Address
City
State
ZipCode
Country

Thanks again for your help
 

Attachments

Well, you have to put textboxes on the form for them. I put in one to test and this worked:

Me.txtCustAddress = Me.CustomerID.Column(3)

I'd point out that you have code in a non-existent control (note the underscore):

Code:
Private Sub Customer[COLOR="Red"]_[/COLOR]ID_AfterUpdate()
Me.CustomerNo = Me.CustomerID.Column(2)
End Sub

Yours has a different name, so this is what's working:

Code:
Private Sub CustomerID_AfterUpdate()
  Me.txtCustAddress = Me.CustomerID.Column(3)
End Sub
 
Great!

Can you re-post the db with your updates to this string please? This would help greatly.

Thanks.
 
Did you get it sorted out? I'm not at the same machine I made the changes on, so I can't post the db right now. It's pretty easy, just add bound textboxes for the fields you want and code like I posted.
 
I am sorry Pbaldy, but I tried what you suggested several times using several different variations without successful results. Can you repost the file I posted with your changes. It would sure be appreciated.

Thanks,
 
Thanks pbaldy. Your solution worked great!!!
 

Users who are viewing this thread

Back
Top Bottom