Clearing Unbound ComboBox fields

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

Guest

I'm rather inexperienced with Access 2002, so bear with me because this is
probably a really easy-to-answer question! I am modifying a database that
someone else created some time ago for reporting issues they come up with
when testing software. The form has several comboboxes on it and most are
bound (the ones I added are unbound). When I click on "Save" to save a new
record, it will save the record and clear the bound comboboxes, however it
will keep the selected values in the unbound comboboxes. This is the code
that goes with the "Save" button:

Private Sub Button68_Click()
On Error GoTo Err_Button68_Click


DoCmd.GoToRecord , , acNewRec
DoCmd.GoToControl "ISSUENAME"

Exit_Button68_Click:
Exit Sub

Err_Button68_Click:

Resume Exit_Button68_Click

End Sub

Anyone have any quick/easy ideas on how I can get those unbound comboboxes
cleared when saving the record?

Thank you in advance!
 
Try adding the following line before going to the "ISSUENAME" control:

Me.Combo1.Value = ""

HTH
Diana Criscione
 
Sonny said:
I'm rather inexperienced with Access 2002, so bear with me because
this is probably a really easy-to-answer question! I am modifying a
database that someone else created some time ago for reporting issues
they come up with when testing software. The form has several
comboboxes on it and most are bound (the ones I added are unbound).
When I click on "Save" to save a new record, it will save the record
and clear the bound comboboxes, however it will keep the selected
values in the unbound comboboxes. This is the code that goes with
the "Save" button:

Private Sub Button68_Click()
On Error GoTo Err_Button68_Click


DoCmd.GoToRecord , , acNewRec
DoCmd.GoToControl "ISSUENAME"

Exit_Button68_Click:
Exit Sub

Err_Button68_Click:

Resume Exit_Button68_Click

End Sub

Anyone have any quick/easy ideas on how I can get those unbound
comboboxes cleared when saving the record?

Thank you in advance!

I'm guessing that you probably want to clear the combo boxes every time
you go to a new record. If that's so, you could use code like this in
the form's Current event:

'----- start of example code -----
Private Sub Form_Current()

Me.Combo1 = Null
Me.Combo2 = Null
' ... and so on. Substitute your own control names.

End Sub
'----- end of example code -----
 

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

Back
Top