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

How to clear form without setting DataEntry property to yes

100+
P: 547
I would like to clear the data displayed in a subform with VBA using a button, similar to when you have the DataEntry property set to NO, and then has to close and open a specific form, to clear it.

In short, the data will be displayed in form until you clear it with a button - (dataentry will be yes, till you press the clear button)

My reason for doing this - when i temporarily close the main form and return later, all data captured are deleted from the subform, and i then have to check what was the last data captured, before continuing with the next lot. This wastes time.

the main form is "StocktakeF"
the subform is called : "Fis_stocktakeSF"

Any suggestions?
Apr 1 '12 #1

✓ answered by ADezii

@neelsfer
Try:
Expand|Select|Wrap|Line Numbers
  1. On Error Resume Next
  2. Dim ctl As Control
  3.  
  4. For Each ctl In Me.Controls
  5.   ctl.Value = Null
  6. Next

Share this Question
Share on Google+
3 Replies


ADezii
Expert 5K+
P: 8,601
@neelsfer
Try:
Expand|Select|Wrap|Line Numbers
  1. On Error Resume Next
  2. Dim ctl As Control
  3.  
  4. For Each ctl In Me.Controls
  5.   ctl.Value = Null
  6. Next
Apr 1 '12 #2

100+
P: 547
It's not clearing the subform data = Fis_stocktakeSF when DataEntry property set to NO. Anything else you can suggest?
Apr 1 '12 #3

ADezii
Expert 5K+
P: 8,601
Modify the code for the code for the Sub-Form Controls.
Apr 2 '12 #4

Post your reply

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