98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Access VBA Training and help » Using both fields/columns selected in combo box | Access forum
Using both fields/columns selected in combo box | Access forum
Resolved · Low Priority · Version 2003
Mark has attended:
Access Intermediate course
Access Advanced course
Access VBA course
Using both fields/columns selected in combo box
Hi,
I am studying the code from the vba course. I have a combo box cmbEmployee and we made it load with the Employee ID field (hidden by zero column width) and the Employee name for the user to select. The ID is taken (by way of default) to store in the intEmployee variable.
The bit I am interested in is the label for the sales analysis output. Currently I have sales of the product selected and "by employee 4" for example. I want to obtain a second variable from the combo selection so that I can show the name and not the ID here.
I have inserted Dim strEmployee As String to be in addition to Dim intEmployee as Integer but would love to know how I obtain the employee name for the string whilst still also having the integer variable.
Thanking you in anticipation --
Regards, Mark
RE: Using both fields/columns selected in combo box
I have luckily come across the same problem posted by someone else on another forum. To access the other columns in the combo box one can use the .column(col no) reference. The first column is 0. Hence for my two column combo I got two values to play with using the following.
intEmployee = Me.cmbEmployee.Value
strEmployeeName = Me.cmbEmployee.Column(1)
Regards, Mark
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Access tip:Calculating The Difference Between DatesIf you wish to calculate the time between two date fields, this can be done in a number of ways: |