Display First Record from Combo Box

  • Thread starter Thread starter justin.poole
  • Start date Start date
J

justin.poole

How can be tell the form to display the first record that is
in a combo box when the form opens?

Software: Access 2002
 
How can be tell the form to display the first record that is
in a combo box when the form opens?

Software: Access 2002

I'm not sure at what point the combo box's list is populated, compared
to the loading of the form. You could try something like this air code:

'----- start of untested air code -----
Private Sub Form_Load()

With Me!cboMyCombo
If .ListCount > 0 Then
Me.Recordset.FindFirst "IDField=" & .ItemData(0)
End If
End With

End Sub
'----- end of untested air code -----

That assumes that the ID field in the form's recordsource is numeric.
If it's text, we'd need to add quotes to the FindFirst criterion.
 

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

Similar Threads

Combo box question 7
Combo box to select records on a form 3
Combo Box and First Record 5
Combo Box 3
combo box filter 1
Combo box to control two sub forms 2
Combo box contents not updating 1
Combo Box Values 5

Back
Top