Solved

MS Access Combobox and VBA Select

Posted on 2013-01-16
8
644 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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

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.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

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