Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2003
    Posts
    58

    Question Unanswered: Update Query Completes Regardless

    Hi all,

    I have a simple table with a UserName and PrintedDate fields, and have used the design GUI to produce a query to update the PrintedDate to the date() if the existing printed date IsNull.

    The logic works fine however when the prompt asks weather you wish to run this quey and you select NO it displays "query aborted by the user" but updates the PrintedDate regardless....


    Am i going mad...

    Thanks

    Jnr.

  2. #2
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    Post the code you used.
    All code ADO/ADOX unless otherwise specified.
    Mike.

  3. #3
    Join Date
    Oct 2003
    Posts
    58

    Talking Code

    UPDATE Visits SET Visits.PrintedDate = Date()
    WHERE (((Visits.PrintedDate) Is Null));

  4. #4
    Join Date
    Oct 2003
    Posts
    58

    Angry Re: Code

    Originally posted by 130213
    UPDATE Visits SET Visits.PrintedDate = Date()
    WHERE (((Visits.PrintedDate) Is Null));
    See its a simple query but it completes regardless.... am I the only one with this problem?

  5. #5
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    Sorry, I am looking for the VBA code you used in your GUI.

    Personally, I would use the MsgBox like this:

    If MsgBox ("Do you want to exec the query", vbYesNo) = vbNo then
    MsgBox "Query Aborted"
    else
    currentproject.connection.execute YourSQLGoesHere
    End If
    All code ADO/ADOX unless otherwise specified.
    Mike.

  6. #6
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Originally posted by HomerBoo
    Sorry, I am looking for the VBA code you used in your GUI.

    Personally, I would use the MsgBox like this:

    If MsgBox ("Do you want to exec the query", vbYesNo) = vbNo then
    MsgBox "Query Aborted"
    else
    currentproject.connection.execute YourSQLGoesHere
    End If
    I think he didn't write a code for that. But he means, when you run an update query you would be asked to update the affected recordes or not (Commit or Rollback) this message which you could turn off using DoCmd.SetWarnings False

  7. #7
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    It really depends on how the GUI produces the query and what other conditions are present at the time (Such as the Warning State).

    If the statement was to be entered into the SQL view of a query, and executed, if the interface provided the option to cancel it, it would't execute. I believe something else is present which is not listed in the post.

    BTW, how do you do that

    quote
    -------------------------------------
    -------------------------------------

    thing?
    All code ADO/ADOX unless otherwise specified.
    Mike.

  8. #8
    Join Date
    Oct 2003
    Posts
    58

    Hang on....

    Thanks for your replys.

    The query will be run by clicking on the query icon, there is no more to the problem, that really is the code!

    hammbakka is correct it is the standard message that appears when you run any query(when the warnings are on)...

    I cant understand it!

    Jnr.

Posting Permissions

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