sql vba variables recordset
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Access VBA Training and help » Using both fields/columns selected in combo box

Using both fields/columns selected in combo box

resolvedResolved · Low Priority · Version 2003

replyReply Fri 7 May 2010, 13:38 Edited on Sat 8 May 2010, 19:55Delegate Mark said...

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

For upcoming training course dates see: Pricing & availability

replyReply Mon 10 May 2010, 21:37Delegate Mark said...

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

 

Please browse our web site to find out more about
advanced micorosoft access training and other Microsoft training courses.

Access tip:

Label printing

You can create a report in Access for printing labels All you have to do is is click New under the Reports object and then select Label Wizard and follow the steps

View all Access hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard