Combo Box - After update...

B

Brett Davis

Hello...

I want to update a field on my form with a value that is in my combo box
list. So for example, I have three columns I have chosen and viewing in the
combo box:
id (this will get stored in the product_id field in the
record source table of the form)
name (this will be displayed in the combo box)
verison (i want this field to be populated from the third column
in my combo box after I select the right product)

Is there away programmatically that I am able to do this without doing a
DLookup?

I am using Access XP.

Please advise...

Cheers!
Brett
 
G

Graham R Seach

Brett,

You can access the 3rd column programmatically. In the combo's AfterUpdate
event, use the following pseudo code.

Me!txtSomeTextBox = Me.cboMyCombo.Column(2, Me.cboMyCombo.ListIndex)

But I have to ask why, if you're already storing the combo's Primary Key,
you want to store another value from the same combo? This breaks
normalisation rules, and you can always retrieve the value at runtime.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html
 

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