?
Solved

MS Access Combobox and VBA Select

Posted on 2013-01-16
8
Medium Priority
?
660 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
[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
  • 4
  • 4
8 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 38784901
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
ID: 38789373
caprocorn1
Yes...it's multicolumn
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38789384
did you try the codes ?
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 

Author Comment

by:lrbrister
ID: 38789426
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
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38789446
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
ID: 38789476
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 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38789487
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
ID: 38789518
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

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.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
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…
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…
Suggested Courses

752 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