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
Solved

MS Access 2003 COmbobox and VBA - Selected Item

Posted on 2012-12-24
3
917 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
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Article by: Leon
Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

839 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