Access 2000 Combo Box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have used a combo box on a form to select data and then fill in a second
box, but when I open the form there is already something in the second box.

How do I make sure that both fields are empty when I Open the form. And only
update after I have selected something from the combo box.
 
You are probably opening to an existing record or the box has a default value.

If the former, put this in the form's Open event to force it to go to a new
record when the form opens:

Private Sub Form_Open(Cancel As Integer)
DoCmd.GoToRecord acForm, Me.Name, acNewRec
End Sub

If the latter, clear the default value from the second box.

To ensure that the record is not save (update) until after the combo box is
populated:

Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Combo1) Then
MsgBox "Please enter combo1."
Cancel = True
End If
End Sub
 
Back
Top