Results 1 to 4 of 4
  1. #1
    markod is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2010
    Posts
    9

    Running an update query

    Hello,


    It seems there are many ways to skin a cat running SQL in VB. Here's my very basic question.

    I have two update queries in my Access database. Query_Update_Avail and Query_Update_NotAvail. The queries simply set the value in a field to Yes or No indicating the line item is available or not. The queries work fine.

    I have a checkbox on my form that when checked I would like to execute the Query_Update_Avail. When unchecked it would execute the Query_Update_NotAvail query. Both suppressing any warnings regarding "you are about to update X records"

    I'm sure this is simple but I just need the syntax. Thanks very much

  2. #2
    KathyL is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    94
    Quote Originally Posted by markod View Post
    Hello,
    It seems there are many ways to skin a cat running SQL in VB. Here's my very basic question.

    I have two update queries in my Access database. Query_Update_Avail and Query_Update_NotAvail. The queries simply set the value in a field to Yes or No indicating the line item is available or not. The queries work fine.

    I have a checkbox on my form that when checked I would like to execute the Query_Update_Avail. When unchecked it would execute the Query_Update_NotAvail query. Both suppressing any warnings regarding "you are about to update X records"

    I'm sure this is simple but I just need the syntax. Thanks very much
    Every control can have event processing attached to it. Place an event (like a click event) on the checkbox with VB code behind it to cause the query to run. Use Docmd.setwarnings false or true to suppress warnings.

  3. #3
    markod is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2010
    Posts
    9
    Hi, thanks for the reply. Do you know what the VB code would be to execute the query?

    Thanks

  4. #4
    markod is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2010
    Posts
    9

    Solved

    Thanks for the help. Here is the solution I used.

    DoCmd.SetWarnings False
    DoCmd.OpenQuery "Query1Name"


Please reply to this thread with any new information or opinions.

Similar Threads

  1. Query with a running sum
    By is49460 in forum Queries
    Replies: 3
    Last Post: 09-07-2013, 11:11 PM
  2. Running update query in access 2010
    By dbansal in forum Queries
    Replies: 1
    Last Post: 09-03-2010, 10:57 AM
  3. Help Automatically running and Update Query
    By JohnRandolphSTL in forum Queries
    Replies: 8
    Last Post: 04-13-2010, 02:08 PM
  4. running a function after update
    By jamin14 in forum Programming
    Replies: 9
    Last Post: 04-06-2010, 09:40 AM
  5. Replies: 0
    Last Post: 06-21-2009, 01:29 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums