J justin.poole Sep 1, 2006 #1 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
D Dirk Goldgar Sep 1, 2006 #2 How can be tell the form to display the first record that is in a combo box when the form opens? Software: Access 2002 Click to expand... 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.
How can be tell the form to display the first record that is in a combo box when the form opens? Software: Access 2002 Click to expand... 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.