By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,589 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,589 IT Pros & Developers. It's quick & easy.

Clearing multiple combo boxes on a form when proceeding to next record

P: 8

I'm attempting to create a form where the multiple combo boxes are cleared when I proceed to the next record. I have applied the below code and it works to clear one of the combo boxes but not any of the others. I have applied this to each combo box by going to Properties -> Event tab -> On Click -> [Event Procedures].

Any help is greatly appreciated!

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.     With Me
  3.         If .NewRecord Then .cboYourCombo = .cboYourCombo.DefaultValue
  4.     End With
  5. End Sub
Sep 21 '15 #1

✓ answered by Seth Schrock

Are you combo boxes bound or unbound?

Share this Question
Share on Google+
5 Replies

Seth Schrock
Expert 2.5K+
P: 2,939
The OnClick event doesn't trigger when the form goes to a new record. The form's OnCurrent event does, which is what you have shown in your code above. You would need to add more lines like line 3 inside your With statement, changing the name of the combobox for each one.
Sep 22 '15 #2

P: 8
You can use this:
Private Sub Form_Current()
Expand|Select|Wrap|Line Numbers
  1. On Error Go to ErrorHandler

Expand|Select|Wrap|Line Numbers
  1. Me![cboname of box]= Null
End Sub
Sep 22 '15 #3

P: 8
Thank you! I was able to use this code to clear the combo boxes in my form. Unfortunately it doesn't appear to retain the information if I move to a new record, even if I have "saved" my form inputs using a save button. Are either of you familiar with why my text box information is saved while the combo box information is not?

Thank you again for your time and expertise!
Sep 22 '15 #4

Seth Schrock
Expert 2.5K+
P: 2,939
Are you combo boxes bound or unbound?
Sep 22 '15 #5

P: 8
I just realized that they are unbound. I was able to "bind" these combo boxes and now it works beautifully. Thank you so much!
Sep 22 '15 #6

Post your reply

Sign in to post your reply or Sign up for a free account.