How to clear form without setting DataEntry property to yes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • neelsfer
    Contributor
    • Oct 2010
    • 547

    How to clear form without setting DataEntry property to yes

    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_stocktakeS F"

    Any suggestions?
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Originally posted by neelsfer
    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)

    the main form is "StocktakeF "
    the subform is called : "Fis_stocktakeS F"

    Any suggestions?
    Try:
    Code:
    On Error Resume Next
    Dim ctl As Control
    
    For Each ctl In Me.Controls
      ctl.Value = Null
    Next

    Comment

    • neelsfer
      Contributor
      • Oct 2010
      • 547

      #3
      It's not clearing the subform data = Fis_stocktakeSF when DataEntry property set to NO. Anything else you can suggest?

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        Modify the code for the code for the Sub-Form Controls.

        Comment

        Working...