Combo box and autopopulate?

  • Thread starter Thread starter jms
  • Start date Start date
J

jms

I have a form called Company. This form contains
CompanyID, company name, address, city, state, country,
zip and VendorID. The VendorID is a combo box whose
record source is a linked table (CUSTOMER) from our order
entry system. If the user wants to enter a company that
is NOT a current customer, then the user fills in the
company name, address, city, etc. If the company IS a
current customer, then the user needs only to select the
appropriate vendorID from a multi-column combo box whose
record source is our CUSTOMER table from our data entry
system. When the vendorID is selected, I would like
to "show" the user the current company address information
from our data entry system on the form. I guess there
would be two sections on the form: Non customers and
customers. Any suggestions?

I'm fairly new to VB. So any help you can give would be
greatly appreciated. Thanks!
 
-----Original Message-----
I have a form called Company. This form contains
CompanyID, company name, address, city, state, country,
zip and VendorID. The VendorID is a combo box whose
record source is a linked table (CUSTOMER) from our order
entry system. If the user wants to enter a company that
is NOT a current customer, then the user fills in the
company name, address, city, etc. If the company IS a
current customer, then the user needs only to select the
appropriate vendorID from a multi-column combo box whose
record source is our CUSTOMER table from our data entry
system. When the vendorID is selected, I would like
to "show" the user the current company address information
from our data entry system on the form. I guess there
would be two sections on the form: Non customers and
customers. Any suggestions?

I'm fairly new to VB. So any help you can give would be
greatly appreciated. Thanks!

.
Hi jms,
one possible suggestion is to have the additional company
information included as columns in the combobox rowsource.
Then use the afterupdate event of the combobox to fill a
textbox with these details.

for example
combobox has the following columns
CompanyID, Company, Address, City

with column widths
0cm;4cm;0;0

Private Sub myComboBox_AfterUp()
with myComboBox
txtCompanyAddress=nz(.column(1) & vbnewline _
& .column(2) & vbnewline _
& .column(3),"")
end with
End With
End Sub

replace myComboBox with combobox name
replace txtCompanyAddress with textbox name
nz function handles null values

Luck
Jonathan
 
Thanks, Jonathan. It works great!
-----Original Message-----

Hi jms,
one possible suggestion is to have the additional company
information included as columns in the combobox rowsource.
Then use the afterupdate event of the combobox to fill a
textbox with these details.

for example
combobox has the following columns
CompanyID, Company, Address, City

with column widths
0cm;4cm;0;0

Private Sub myComboBox_AfterUp()
with myComboBox
txtCompanyAddress=nz(.column(1) & vbnewline _
& .column(2) & vbnewline _
& .column(3),"")
end with
End With
End Sub

replace myComboBox with combobox name
replace txtCompanyAddress with textbox name
nz function handles null values

Luck
Jonathan
.
 
Back
Top