Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Feb 2003
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Delete data in a field (2002/SP3)

    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

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Delete data in a field (2002/SP3)

    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.

  3. #3
    2 Star Lounger
    Join Date
    Feb 2003
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete data in a field (2002/SP3)

    Thanks Hans.

    Works great!

    Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •