Results 1 to 6 of 6
  1. #1
    Join Date
    May 2004
    Posts
    133

    Cool Unanswered: turnoff warning message when execute update query

    Hi all
    I'm really stuck. Please help me.

    I have a simple form with a button that have following code:
    dim strSQL as string
    strSQL="update empoyees table set salary = " & me.lstsalary.column(0) & _
    " where workingyears = " & me.lstworkingyears.column(0)
    docmd.runSQL

    Above code is run OK but each time I hit this bitton, a warning message said that you are about to updated n recordes or something like that. Very annoying.
    Could anyone tell me how to turn this message off by using VBA.
    Thanks

  2. #2
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8
    Docmd.setwarning false
    docmd.runSQL
    Docmd.setwarning true

    could be a comma

    Please don't for get to turn them on

    can do a lot of dammage I have Del tables
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  3. #3
    Join Date
    Feb 2006
    Posts
    59
    or try this .. In the menu .. Tools then options then click edit/find tab then under the heading confirm . turn off the check box for action queries and ull get rid of all the query messages

  4. #4
    Join Date
    Feb 2006
    Posts
    59
    Quote Originally Posted by cuongvt
    Could anyone tell me how to turn this message off by using VBA.
    Thanks

    hmm sorry i missed that part . any ways ignore my previous post

  5. #5
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    To accomplish what Stocks159 is talking about in VBA use:

    SetOptions "Confirm Action Queries", False

    I usually set it to false before the query runs and then True after it runs. I prefer to use this over using SetWarnings. This only turns off the messages you get before running an action query (Append, Update, Delete).

  6. #6
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    Nth time
    do NOT mess with Warnings in this case.
    less hassle, less error recovery code, and executes faster:

    currentdb.execute strSQL


    (yessssssssssss it works in all A revs)

    izy
    currently using SS 2008R2

Posting Permissions

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