Combo box and autopopulate?

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!
 
J

Jonathan Parminter

-----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
 
J

jms

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
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Button Click Event 8
Combo box help 1
combo box afterupdate 3
Filter Combo box by another combo box 1
combo box not updated 2
Me.Property 3
Refresh rowsource 5
Can not Set Focus to a Text Box - Error 2110 2

Top