?
Solved

Automatically selecting in cmb

Posted on 2003-03-10
7
Medium Priority
?
292 Views
Last Modified: 2008-03-10
Hello..

Can anyone tell me how I could have the first (and only) option in a combo box to be selected automatically?
I cannot use DefaultValue because the value in the combo box is made to appear according to a value the user chooses in another combo box.

the first combo is cmb1 ...this is where the user select a value
the second combo is cmb2 ..this is where the only available option in the dropdown is supposed to be selected automatically after something is chosen in cmb1.

OnClick Event for cmb1 is: cmb2.SetFocus
Now i need an OnGotFocus event for cmb2 that would choose the option in the dropdown.

I would have done cmb2.Text = "something" but i cant because the values there are always changing.

So..who's gonna push me in the right direction(or..just take me there perhaps)?

thanks
0
Comment
Question by:badarzaman
  • 3
  • 2
  • 2
7 Comments
 
LVL 41

Accepted Solution

by:
shanesuebsahakarn earned 80 total points
ID: 8103450
Try:
Me!cmb2 = Me!cmb2.ItemData(0)
0
 
LVL 2

Expert Comment

by:Loki
ID: 8103673
Your question confuses me.  Why have a combo box if you're only allowing one thing to be selected?  Why couldn't you just derive a value from the first combo box using an if-then-else or case statement in VB?  I guess I don't understand what's taking place after a value is selected in your first combo box.
0
 

Author Comment

by:badarzaman
ID: 8105365
shanesuebsahakarn! That worked great! Thanks.

Loki..actually i have a few cases where 2 values are shown and only then the user is supposed to select one of them.

shanesuebsahakarn...i've seen these Me! thingys before but dont actually know what it is or how it works...can u suggest a page where i'd get this info?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 8106315
Well, Me! just means the current form (the one that the code is in), and ItemData(0) means the data in the first row's bound column.

I think the best place to look would be a good Access book. I don't really have any good recommendations on this score, but I'm sure others can recommend good tutorial books that cover most aspects of Access development.
0
 

Author Comment

by:badarzaman
ID: 8111954
okay...i'll be on the lookout for access books!
0
 
LVL 2

Expert Comment

by:Loki
ID: 8112048
The Access 2000 Developers Handbook by Sybex is great.
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 8112073
The Dev Handbook is great, but it can be quite daunting if you don't have a grounding in Access already. I would start with something a bit more basic, but the Dev Handbook is an invaluable reference.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A Case Study of using the Windows API to provide RS232 communications capability in Access without the use of Active-X controls.
A quick solution showing how to control and open a POS Cash Register Drawer using VBA with MS Access.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

621 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