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

Can I use one clear button/vba command to clear combo boxes and text boxes?

P: 17
Currently I have a form that has bound text boxes and combo boxes on it. Some of the combo boxes are pulling the information from other tables and some are manually entered in. I would like to create a reset form buttn for the form, but not sure how to do that for multiple commands.
Jun 2 '14 #1

✓ answered by NeoPa

Expand|Select|Wrap|Line Numbers
  1. Me.Undo()
This will reset all pending updates for all bound controls on your form and leave the record as it was before any changes were entered.

Otherwise, Jim's post says it all pretty-well. Generally controls would be set to Null where possible, but in some circumstances that isn't possible so setting to a specific ("" or 0) value is called for.

Share this Question
Share on Google+
4 Replies


Expert 100+
P: 1,240
Denielle, depends what you mean by "reset." This sounds like a "advance to new record" request, which would clear all the fields to allow you to enter new data, but would also save any changes on the record currently being edited. But when you start a new record in an Access form fields with default values may not show as "cleared" but with the defaults filled in.

If that is what you want, great. If you want everything being completely cleared you might want to add a button specifically for that purpose and clear each field with me.whatever="" or =0.

Jim
Jun 2 '14 #2

NeoPa
Expert Mod 15k+
P: 31,768
Expand|Select|Wrap|Line Numbers
  1. Me.Undo()
This will reset all pending updates for all bound controls on your form and leave the record as it was before any changes were entered.

Otherwise, Jim's post says it all pretty-well. Generally controls would be set to Null where possible, but in some circumstances that isn't possible so setting to a specific ("" or 0) value is called for.
Jun 2 '14 #3

P: 17
Thank you for the response. Just to clarify, no it is not for an enter and move to new record. I am wanting to use it to clear the form if someone makes an error when entering the information. That way they can click on the clear (reset) button and clear out the entire form to start over. There are over 40 controls on the form so I was trying to see if I could use one code for all for a reset instead of listing all of them in the code. will the code listed below do that? Thanks

Expand|Select|Wrap|Line Numbers
  1. Me.Undo()
  2.  
Jun 4 '14 #4

Expert 100+
P: 1,240
Yes, that will undo any changes since the last save or since moving to that record, whichever came most recently.
Jun 4 '14 #5

Post your reply

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