Can you send values from 2 columns in a Combo Box to 2 text boxes?

B

Bill Artman

I am using Access 2002 with XP and I am designing a Sales Tax database. I
have a created a form with a Combo Box. The Combo Box has 3 columns: City
Name, City Code, Sales Tax percentage and this data is pulled from a Tax
Table.

I have the Combo Box set so when I choose the appropriate City Name the
corresponding City Code appears in the City Code text box on the form. This
works correctly.

My question - is it possible to send the sales tax percentage in the 3rd
column to a text box called Sales Tax on the form the same as I did with the
City Code data?

To summarize can 2 columns of data from a Combo Box be sent to 2 different
text boxes on the form? I hope my question makes sense>

Thanks for your help!
 
I

IanOxon via AccessMonster.com

You can use the Combo Box AfterUpdate event like this:

Private Sub cmbAddress_AfterUpdate()
On Error GoTo Err_cmbAddress_AfterUpdate

txtSales_Tax = cmbAddress.Column(2) 'Columns are numbered from 0 to
ColumnCount - 1.

Exit_cmbAddress_AfterUpdate:
Exit Sub

Err_cmbAddress_AfterUpdate:
MsgBox "cmbAddress_AfterUpdate Error: " & Err.Number & ": " & Err.
Description
Resume Exit_cmbAddress_AfterUpdate
End Sub

This could be adapted to populate as many other controls as you need
 

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

Top