Results 1 to 5 of 5
  1. #1
    cbuechner is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Jan 2021
    Posts
    60

    If any errors

    I'm not sure how to write possible errors into the VBA. The first error I can get is an error if the form ledger isnt open.



    Private Sub Form_Close()DoCmd.SetWarnings False
    DoCmd.OpenQuery "Update_Upload"
    DoCmd.SetWarnings True
    Forms!Ledger.Requery
    End Sub
    Specifically

    Forms!Ledger.Requery
    I thought maybe just add in open form? But was curious how to write in the if any errors.

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Not sure how to interpret your question. Maybe the answer is, learn about error handling and how to write an error handler. This is especially important if you modify app settings such as Warnings. You turn them off, then query execution fails (maybe because you deleted or modified it). You click away the error, code exits and you leave warnings turned off until a) something happens to reverse that or b) until next time you open db.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    cbuechner is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Jan 2021
    Posts
    60
    Thank you....I was trying to get away from having to have the warnings, but then again, I guess its not that much to click thru it. I would prefer to have my own warning, as opposed to the standard warning. I can look more into the error handling. Thank you

  5. #5
    orange's Avatar
    orange is online now Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716

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

Similar Threads

  1. #Num! and #Div! errors
    By frustratedwithaccess in forum Queries
    Replies: 3
    Last Post: 01-29-2015, 08:16 PM
  2. Errors
    By Thompyt in forum Programming
    Replies: 3
    Last Post: 10-31-2014, 01:29 PM
  3. Replies: 4
    Last Post: 06-21-2014, 05:43 AM
  4. Replies: 10
    Last Post: 07-25-2011, 12:07 PM
  5. SQL that errors in VB
    By Wayne311 in forum Programming
    Replies: 3
    Last Post: 02-14-2011, 10:17 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