Combo Box selection

V

Valdoe

In a form I have a combo box with 2 columns weeks and date and 400 lines
Eg
Week 1 1-1-07
Week 2 7-1-07
……..>>>>>>
Week 400 1-12-09

When I click on the combo box I can see the first 10 weeks but then have to
scroll all the way down to week say 200.
What I like to happen is when I click on the combo box that I see week 200
and still have the ability to scroll back to week 1 or forward to week 400
In design mode what is require to enable me to do the above.
Thanks in advance..
 
T

Tal

You can set the default value of the combo box in the OnFocus event of the
combo box. That way when you select it, it will "jump" to the desired record.

Me.cboMyComboBox.Value = "200"

Use the quotes if it's a text field.

Cheers,
Talia
 
V

Valdoe

Please bear with me (newbie)
I am in design mode
clicked on combo box
properties - events
I cannot find OnFocus but see On Got Focus
type what you said - Me.cboMyComboBox.Value = "200"

go back to form and when I click on the combobox get error message
Can't find the macro 'Me" - dont exist - Note that when enter the
macrogroupname.macroname syntax in arguement, you must specify the name the
macro's macro group last saved under...

what am I doing wrong.
ps combo box is Weeks
 
D

Douglas J. Steele

Don't type that expression into the On Got Focus property. Instead, select
[Event Procedure] from the pull down list that the property box becomes,
then click on the ellipsis (...) to the right of the property box. That will
take you into the VB Editor, in the middle of code that should look like:

Private Sub Combo1_GotFocus()

End Sub

(Combo1 will be whatever the name of your combo box is)

Type

Me.Combo1.Value = "200"

between those two lines, so that you end up with:

Private Sub Combo1_GotFocus()

Me.Combo1.Value = "Week 200"

End Sub

(make sure you type the actual name of the combo box where I've got Combo1)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top