Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Store 2 Combobox Values

Status
Not open for further replies.

jocat

Technical User
Dec 28, 2001
25
US
Hello all. I haven't been around for a while.

There is probably a simple solution, but I don't work in Access every day, or perhaps I'm brain dead today.

I have a database for parking violations. I have a parking ticket entry form with a combobox for the violation type. I want to store both the violation type and the violation amount on the individual record for reasons too long to get into. The table of violations types has three fields - violation_ID, Violation_Name and Amount. That is the table that the Combobox references. I know how to get the one of the fields into the parking violation record through the combo box. Is there a simple way to get both fields (Violation_Name and Amount) to be stored on the record, or do I heve to write something in VB (I'm not really experienced in that).

Any help would be appreciated.
 
Have a look at Column property of the ComboBox object (yes, in the VBA help ...)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks for the info.

I looked at a few of your other posts that provided a little more detail and was able to get it to worl.

Have a great day.

Joe
 
. . . or ([blue]you![/blue] substitute proper names in [purple]purple[/purple]):
Code:
[blue]   Me![purple][b]ViolationTextboxName[/b][/purple] = Me![purple][b]ComboboxName[/b][/purple].Column(1)
   Me![purple][b]AmountTextboxName[/b][/purple] = Me![purple][b]ComboboxName[/b][/purple].Column(2)[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
 
Hi

Assuming your combobox is based on the table of violation types, and you have the number of columns set to (say) 3, then the column which is first in the SELECT statement is .Column(0), the next column is .column(1) and the third is .column(2),

say for example you have violation_ID, Violation_Name and Amount, with the Validation_id column hidden (ie column width zero, which is the common way to do this), and that you have the violation_ID as the bound column, then in the after update event you need

Violation_Name = comboboxname.column(1)
Amount = comboboxname.column(2)

Finally can I say I understand why you may wish to save the Amount in the violations table in the way you suggest, but I cannot readily think of a good reason to save BOTH the violation_ID and Violation_Name in the violations table

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Thanks Aceman. I did see one of your posts when I was checking out PHV's postings. I did use your format and it worked fine!

And thanks for your response also, Ken

Joe
 
Ken,

The reason why I want to save both is because in the past we referenced the violation type table to access the violation amount when we were providing a violations listing. We recently increased the fines, so when we printed out a history, all of the old violations came up at the new rate and it appeared as if they had not made a full payment and owed money. Rather than create an if/then statement for determining the violation amount I would rather imbed the violation type and violation amount into the individual record so if we had future increases all I had to do was change the amount in the table.

Thanks again.

Joe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top