CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2001
    Posts
    17

    Running SQL queries

    I am running an SQL query in an Access 2000 database, using the DoCmd.RunSQL "INSERT INTO ...." command.

    The SQL INSERT query is executed without any problems, but I would like not to get the message box that prompts the user to confirm the operation. ("You are about to append..." , "Microsoft Access can't append all the records...").

    Is there a way to programmaticaly answer "Yes" to all of those questions?

    Thanks,
    Yaron.


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Running SQL queries

    You can either turn off warning messages in Acces or use the code

    DoCmd.SetWarnings False(true)

    This is a VBA call. In Access, this will turn off system warnings, such as "1000 records will be deleted" -
    it acts as if you select the default (hit enter) at each of these prompts, allowing your code or macro to run
    without user intervention.




    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    May 2006
    Posts
    46

    Unhappy Re: Running SQL queries

    If you are using an ADO to execute the access queries from in VB, what command can be used not to get the warning messages? The code for the ADO execution is:
    cmdAccess.Execute , , adasyncexecute
    The problem I have is that my execution from VB seems to cancel when the warning message for access appears. If there is no warning message my query executes and data is inserted into the sql table.
    as far as I know ADO command objects should not have a problem with warning messages from Access.

    can anyone help me please, this is quite urgent?
    Last edited by cvdnest; June 1st, 2006 at 08:56 AM.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured