Combo box

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

Guest

I have form that is driven by a combo box. The box lists order numbers and
is used to pull up appropriate orders for entry or edits.

When the form launches the box is empty, but the values in the text boxes
default to the first record in the table behind the form.

How does one prevent that; I'd like them to be all blank.

Pepe
 
One option is to have the form go to a new record when it opens:

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


"pepenacho" wrote ...
 
Ok,
Since your form is bound to a table and always opens to the first record,
you really can't clear the textboxes without having the underlying fields
being cleared as well. So your other choice is it create a new record
that's blank and write down its ID number (you only need to do this once
just to get a blank record in the table). When the form first opens, go to
that record. You'll probably want to also use the form's OnCurrent event to
check to see if this record is being displayed, and if it is, don't let
anyone change it. Let's say your Primary Key field is called RecordID and
the blank record's ID is 12345:

Private Sub Form_Open(Cancel As Integer)
Me.Recordset.FindFirst "[RecordID] = 12345"
End Sub
 
Mark,

The dummy record was a big help already. But I like this furhter idea of
defaulting into the dummy record on open. I'll put it in thanks.

Pepe

Mark said:
Ok,
Since your form is bound to a table and always opens to the first record,
you really can't clear the textboxes without having the underlying fields
being cleared as well. So your other choice is it create a new record
that's blank and write down its ID number (you only need to do this once
just to get a blank record in the table). When the form first opens, go to
that record. You'll probably want to also use the form's OnCurrent event to
check to see if this record is being displayed, and if it is, don't let
anyone change it. Let's say your Primary Key field is called RecordID and
the blank record's ID is 12345:

Private Sub Form_Open(Cancel As Integer)
Me.Recordset.FindFirst "[RecordID] = 12345"
End Sub


Mark,

interesting thought; I wish that was an option.

Thanks.

Pepe
 
Back
Top