Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 677
  • Last Modified:

MS Access Combobox and VBA Select

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
lrbrister
Asked:
lrbrister
  • 4
  • 4
1 Solution
 
Rey Obrero (Capricorn1)Commented:
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
 
lrbristerAuthor Commented:
caprocorn1
Yes...it's multicolumn
0
 
Rey Obrero (Capricorn1)Commented:
did you try the codes ?
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
lrbristerAuthor Commented:
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
 
Rey Obrero (Capricorn1)Commented:
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
 
lrbristerAuthor Commented:
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
 
Rey Obrero (Capricorn1)Commented:
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
 
lrbristerAuthor Commented:
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now