Solved

MS Access Combobox and VBA Select

Posted on 2013-01-16
8
642 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dsum Function for List Box Data 7 48
Dlookup MSACCESS 5 25
backup programme - VBA 3 24
Access summarise unique values in tables 2 16
The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
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…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

821 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