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

G

Guest

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

Guest

Arvin;

Thank you for your quick reply. I am not familar with the code you gave me.
Where to I insert the lines that you gave me and do I use the exact words
except for specifing the column numbers.

Thanks again - have a great week!

--
Regards,

Bill Artman


Arvin Meyer said:
Sure, just use code like this:

Sub MyCombo_AfterUpdate()
Me.txtOne = Me.ComboName.Column(1)
Me.txtTwo = Me.ComboName.Column(2)
End Sub

The column index is zero based so the first column is Column(0)
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 
A

Arvin Meyer [MVP]

Open the form in Design View and select the combo box. Open the combo box
property sheet (double-click on the combo, use the View menu, or the
propertysheet button on the toolbar). Click on the Events tab and find the
After Update event. Now click in the box next to it and, then on the down
arrow and choose [Event Procedure]

Now click on the ellipses (...) button and you'll be taken to the code
window with the code stub filled in like this:

Sub MyCombo_AfterUpdate()

End Sub

Your code window will have the correct name of your combo box. Now type in
the code (or cut & paste it) from below, substituting the correct combo box
name. That should do it for you.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

Bill Artman said:
Arvin;

Thank you for your quick reply. I am not familar with the code you gave me.
Where to I insert the lines that you gave me and do I use the exact words
except for specifing the column numbers.

Thanks again - have a great week!

--
Regards,

Bill Artman
 
G

Guest

Arvin;

Thanks very much for the additional information. I really appreciate it. I
will try what you said tomorrow. Thanks again!
--
Regards,

Bill Artman


Arvin Meyer said:
Open the form in Design View and select the combo box. Open the combo box
property sheet (double-click on the combo, use the View menu, or the
propertysheet button on the toolbar). Click on the Events tab and find the
After Update event. Now click in the box next to it and, then on the down
arrow and choose [Event Procedure]

Now click on the ellipses (...) button and you'll be taken to the code
window with the code stub filled in like this:

Sub MyCombo_AfterUpdate()

End Sub

Your code window will have the correct name of your combo box. Now type in
the code (or cut & paste it) from below, substituting the correct combo box
name. That should do it for you.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

Bill Artman said:
Arvin;

Thank you for your quick reply. I am not familar with the code you gave me.
Where to I insert the lines that you gave me and do I use the exact words
except for specifing the column numbers.

Thanks again - have a great week!
 
G

Guest

Arvin;

Thanks again for your answer. I tried it and it works perfect. Have a
great day!

--
Regards,

Bill Artman


Bill Artman said:
Arvin;

Thanks very much for the additional information. I really appreciate it. I
will try what you said tomorrow. Thanks again!
--
Regards,

Bill Artman


Arvin Meyer said:
Open the form in Design View and select the combo box. Open the combo box
property sheet (double-click on the combo, use the View menu, or the
propertysheet button on the toolbar). Click on the Events tab and find the
After Update event. Now click in the box next to it and, then on the down
arrow and choose [Event Procedure]

Now click on the ellipses (...) button and you'll be taken to the code
window with the code stub filled in like this:

Sub MyCombo_AfterUpdate()

End Sub

Your code window will have the correct name of your combo box. Now type in
the code (or cut & paste it) from below, substituting the correct combo box
name. That should do it for you.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

Bill Artman said:
Arvin;

Thank you for your quick reply. I am not familar with the code you gave me.
Where to I insert the lines that you gave me and do I use the exact words
except for specifing the column numbers.

Thanks again - have a great week!

--
Regards,

Bill Artman


:

Sure, just use code like this:

Sub MyCombo_AfterUpdate()
Me.txtOne = Me.ComboName.Column(1)
Me.txtTwo = Me.ComboName.Column(2)
End Sub

The column index is zero based so the first column is Column(0)
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access


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!
 

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