Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2005
    Posts
    61

    Unanswered: how to have system Auto Answer yes to prompt

    Hello All,

    Ok here is what I need to do. I am updating many records. I have a script go through and strip out characters i don't want. (Thanks to posts here on dBForums I was able to learn how to do that)

    Once I update the value of the field I execute the following sql command.

    DoCmd.RunSQL "UPDATE MembershipUpdate SET MembershipUpdate.[C Home #] = " & StripPhoneNumber & " WHERE (((MembershipUpdate.[ID])= " & lngRecordNumber & "))"

    Which works great but I receive the "You are about to update 1 row(s) yes or now.

    I am executing this code and know that it's going to be updating records which is why I had to run the code in the first place.

    How do I make the system not prompt me for this and just update the record? Is there any way to be able to do this in code?

    As always thanks for the help.

  2. #2
    Join Date
    Apr 2004
    Location
    outside the rim
    Posts
    1,011
    DoCmd.SetWarnings False

    This causes Access to use the default answer in message boxes. Make sure you turn warnings back on immediatly after your update though!

    tc

  3. #3
    Join Date
    Apr 2005
    Posts
    61

    Thanks for quick response

    Thank you very much My yes clicking days are over

    Mythos

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    much faster, much safer:
    currentdb.execute "UPDATE blah blah blah....."

    faster: uses the intrinsic DAO-ness of ALL access forms (all revs!) rather than force-fitting the DAO-ness of the form into the ADO model.

    safer: errors will not leave you with .warnings off since you dont play with warnings at any time.

    izy
    currently using SS 2008R2

  5. #5
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004

    Talking

    Quote Originally Posted by izyrider
    much faster, much safer:
    currentdb.execute "UPDATE blah blah blah....."

    faster: uses the intrinsic DAO-ness of ALL access forms (all revs!) rather than force-fitting the DAO-ness of the form into the ADO model.

    safer: errors will not leave you with .warnings off since you dont play with warnings at any time.

    izy
    Here, here....I too agree with Izy....that is the best way, because people usually tend to forget at times to end with SetWarnings = True to get things back in order.

    BUDster

Posting Permissions

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