Results 1 to 10 of 10
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, CA, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Clear field in continuous forms (2002)

    I have a continuous form with a field quantity. The entry operator puts in the quantity in this field. There might be 10-50 fields filled out and I want to have a button that clears the field down the Continuous Form. I tried find and replace using "" and is not null and I can't get it to clear the field down.
    Frank Hoeffer

  2. #2
    3 Star Lounger
    Join Date
    Jun 2001
    Location
    Maidstone, Kent, England
    Posts
    398
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Clear field in continuous forms (2002)

    when you say
    <hr>a button that clears the field down the Continuous Form<hr>
    Do you mean to clear that field in all subsequent records or to clear the rest of the fields for the same record?

    Peter

  3. #3
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, CA, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Clear field in continuous forms (2002)

    I want a button that when clicked will clear the field quanity in each record in a continuous form. Some records might be empty some have entries.

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Clear field in continuous forms (2002)

    You're thinking of spreadsheets, where rows have a specified position and you can do something like clear column A. If you want to clear the field in all records in the table, you can do it with an update query, but that isn't necessarily the same thing as clearing the records in the form, since the latter may be filtered down to a limited recordset.
    Charlotte

  5. #5
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, CA, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Clear field in continuous forms (2002)

    Thanks that works but I'd like to use find and replace.
    How do you find say numbers > 0 and then replace them with "".
    Frank

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Clear field in continuous forms (2002)

    You don't. Find and replace is simplistic. You can only find and replace literal matches. If you want to use a condition like that, you'll need to use a query.
    Charlotte

  7. #7
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, CA, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Clear field in continuous forms (2002)

    Thanks, was beating my head against the wall trying to get it to to that.
    I guess I will have to use the update query. Is there any way to surpress the dialog box and have it just update the records.
    Frank

  8. #8
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Clear field in continuous forms (2002)

    You can turn off the confirmation message in Tools...Options...Edit/find...Confirm Action Queries
    Regards
    John



  9. #9
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Clear field in continuous forms (2002)

    In addition to the method John suggested, there are several other ways you can suppress the message. I shy away from turning off the confirmations because when I run a query from the database window, I want to see the messages. If you use something like DoCmd.OpenQuery or DoCmd.RunSQL to execute the query, you can use DoCmd.SetWarnings False in the preceding line to turn off the confirmation and then DoCmd.SetWarnings True to turn them back on. The method I prefer is to use the Execute method of a querydef object in DAO to run the query. That bypasses the confirmation message entirely but lets you test in code for the RecordsAffected property of the querydef to determine whether any records were actually updated.
    Charlotte

  10. #10
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, CA, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Clear field in continuous forms (2002)

    Hi Charlotte, (and John)
    Great, that did it.
    Using DAO is a little beyond me right now.
    Thank you for your through explanation.
    Frank <img src=/S/bananas.gif border=0 alt=bananas width=33 height=35>

Posting Permissions

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