Solved

MS Access Combobox and VBA Select

Posted on 2013-01-16
8
637 Views
Last Modified: 2013-01-17
I have a Sub/SubForm with a ComboBox on it.

The Combobox has about 10 items in it, pulled from SQL Server with a empty top lone.

On Form open, how do I select the first row down using VBA?
(Not the top "empty" row
0
Comment
Question by:lrbrister
  • 4
  • 4
8 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
Comment Utility
try

me.combo0.value=me.combo0.itemdata(0)

or

me.combo0.value=me.combo0.itemdata(1)

is the rowsource of your combo is multicolumn?
0
 

Author Comment

by:lrbrister
Comment Utility
caprocorn1
Yes...it's multicolumn
0
 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility
did you try the codes ?
0
 

Author Comment

by:lrbrister
Comment Utility
capricorn1
Yes its setting it correctly...just checked your code out.

But I also have some code that runs on the Combobox after update event
 cmbVisits_AfterUpdate()

How do I run that after your code?
 Me.cmbVisits.Value = Me.cmbVisits.ItemData(0)

Or do I need to award points on this open another question?
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility
no need to use this codes
Me.cmbVisits.Value = Me.cmbVisits.ItemData(0)

in the afterupdate event of the combo box,
if you select an item from the combo box, that will be the value of the combo box.
0
 

Author Comment

by:lrbrister
Comment Utility
capricorn1
This combobox is actually in a sub form

The subform has 6 other subforms with it
The 6 other subforms get updated by the After update event of this combobox

So....
I'm setting the value...and it shows when I go to the subform
but the after update...which loads all the other forms is not running
0
 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility
well that is another problem..

post another Q and upload the db app.

it will be difficult to troubleshoot it without seeing the app
0
 

Author Closing Comment

by:lrbrister
Comment Utility
This is actually working now.

I have other After_Update issues that will be addressed in another question with a database attached.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Lync meeting or Lync conferencing is what many organizations would like to deploy to allow them save money. But companies are now giving up for various reasons, one of which is that they cannot join external meetings (non-federated company meetings)…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

762 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now