Solved

MS Access 2003 COmbobox and VBA - Selected Item

Posted on 2012-12-24
3
940 Views
Last Modified: 2012-12-24
My attached code works fine...
But, I've been out of VBA for a while.

When I select an Item, I want to display both columns...not just the bound one.

How do I do that?

Dim cmd1 As New ADODB.Command
Dim rst1 As ADODB.Recordset
'Connect to db and run stored proc based on Client ID
cmd1.ActiveConnection = CurrentProject.Connection
cmd1.CommandType = adCmdStoredProc
cmd1.CommandText = "usp_MarketingVisitationsGet"
cmd1.Parameters("@ClientID") = Me.txtClientID.Value

'Set the recordset
Set rst1 = cmd1.Execute()

With Me.cmbVisits
    .RowSourceType = "Value List"
    .BoundColumn = 1
    .ColumnCount = 2
    .ColumnWidths = ".5in;1.5in"
    .ColumnHeads = False
End With

With rst1
    .MoveFirst
    Do Until .EOF
        cmbVisits.AddItem !id & ";" & !visitStatus
        .MoveNext
    Loop
End With

Open in new window

0
Comment
Question by:lrbrister
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Expert Comment

by:JieJenn
ID: 38719055
Can you attach a sample database? Your code looks fine to me.

Perhaps expand your combo width to see what happens.
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 500 total points
ID: 38719081
"I want to display both columns..."
Do you mean after the selection?
You cannot do that - unless you create a concatenated column.

mx
0
 

Author Closing Comment

by:lrbrister
ID: 38719137
Thanks
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question