Last Hope

  • Thread starter Thread starter Court
  • Start date Start date
C

Court

I have a table with four fields in it. I called it Table
1.
Customer Name (Text)
Account Number (Number)
Phone number (Number)
e-mail address (Text)
Amount (Number)

I have a second table (Named Table 2) with two fields on
it. It serves as a master list for all of our customers.
Customer Name (Text)
Account Number (Number)

I have created a form for easier and more attractive data
entry. I would like to create a combo box for the
account number that pulls from Table 2 and documents it
in Table 1. I would then like for it to, automatically,
populate the customer name in a separate text box on the
form based on the account number in my master list (Table
2). Once the form autopopulates with the customer name,
I would like for that name to go to Table 1.

I know how to create a two column drop down, but I really
would like for the customer name to auto-populate in a
separate field.

I hope I have included enough information. If I haven't,
please let me know what you need because I don't know
what else to share.

Thanks a million.
 
Court

Assuming that the Customer name is a bound field on your form for table 1,
then in the combo drop down that is based on table 2, in the After Update
event add code like this:

Assuming that column 0 of the combo is the Account number and column 1 is
the customer name:

If Len(Me!cboCustomerLookUp)>0 Then
Me!AccountNumber = Me!cboCustomerLookup.Column(0)
Me!CustomerName = Me!cboCustomerLookup.Column(1)
End if
 
From your description I gues you did not intend to put 5
names in the 4 field table so one of them is not there?
When you create a form and subform as I think you intend ,
The main form would contain the data from table 2 and the
subform would contain the data from table 1
When you set the Master-Child relationship of the subform,
the linking information will be automatically entered when
you populate the remaining data in the subform.
I usually hide the linking field in the subform so as to
prevent the user from changing the linking data ob the
subform (table 1)
You may also consider setting the relationships for the
tables from the toolbar, that way you can set to make sure
that relationships are updated etc.
Hope this helps.
Fons
 
Back
Top