Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo boxes and default values

Status
Not open for further replies.
Mar 12, 2001
30
GB
Hi all

I have 2 combo boxes on a form. They are both linked to SQL statements in the row source property. They are actually two sets of dates.

Basically I want to set the default value of the first combo box to be it's first date in the list....and the last date in the list for the second combo box.

I want users to see these values after the form with the combo boxes has been opened (ie., default values visible, rather than having to open the combo box manually).

Can anyone offer any help/guidance.

Thanks in advance for any support!

Dee
 
Hi,

Maybe, it's not the best way to do it, but I can't think abount anything else right now.
Try to do this:

Private Sub Form_Open(Cancel As Integer)
Combo1.Value = Combo1.Column(0, 0)
Combo2.Value = Combo2.Column(0, Combo2.ListCount - 1)
End Sub

I mean that you shuld insert the values to ComboBoxes when you open the form.

Good luck
 
Thanks galar. I have several hundred items in the both lists therefore I feel this is not the most appropriate solution. It's frustrating because someone showed me how to solve the problem years ago but I cannot remember.

Many thanks for you help regardless!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top