• Delete data in a field (2002/SP3)

    Author
    Topic
    #449310

    I have a form with two fields – LNFN (names) and label. I use the form to mark with an x in the label field the names that I want to print labels for. Works great!

    Now I would like to have a way to remove all the x’s after the labels are printed so I can start out the next time with a blank label field. I want to clear the label field for all the names without deleting the LNFN fields. Ideally I want to do this with a command that follows the print command so the entire process is automatic. My second choice is to create a Clear button that would erase the x’s.

    Any suggestions.

    Thanks.

    Paul

    Viewing 0 reply threads
    Author
    Replies
    • #1101357

      You can add these lines of code to the On Click event procedure of the print button (*after* the code that prints the labels) or in the On Click event procedure of a separate button:

      Dim strSQL As String
      ‘ Substitute the name of the table in the next line
      strSQL = “UPDATE [NameOfTable] SET label = Null”
      DoCmd.SetWarnings False
      DoCmd.RunSQL strSQL
      DoCmd.SetWarnings True

      You may have to use Me.Refresh or Me.Requery after these lines to see the label field cleared.

    Viewing 0 reply threads
    Reply To: Delete data in a field (2002/SP3)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: