Results 1 to 12 of 12

Thread: Display Alerts in Access

  1. #1

    Thread Starter
    Member
    Join Date
    May 2005
    Posts
    32

    Resolved Display Alerts in Access

    Hey,

    Is there a method similar to ExcelApplication.displayalerts = False to suppress any messages created in Access. When I run a macro in Access VBA, it complains about a few records not being complete, and I do want to display this message.

    Thanks for your help,

    VO
    Last edited by ovlia1286; Jun 23rd, 2005 at 11:06 AM.

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Display Alerts in Access

    i think you will need to get the information you want to display and use a message box

    pete

  3. #3

    Thread Starter
    Member
    Join Date
    May 2005
    Posts
    32

    Re: Display Alerts in Access

    No, I don't want it to display any messages/alerts...

    Vince

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Display Alerts in Access

    and I do want to display this message.
    sorry i got it wrong

    just put in error handling with resume next

    pete

  5. #5

    Thread Starter
    Member
    Join Date
    May 2005
    Posts
    32

    Resolved Re: Display Alerts in Access

    Wow, I should of tried that... thanks for your help .

    VO

  6. #6

    Thread Starter
    Member
    Join Date
    May 2005
    Posts
    32

    Unhappy Re: Display Alerts in Access

    It didn't work... when i step through the code, the alert occurs before the code goes to the error handle. The alert is the following: "Microsoft is unable to apend all the data to the table. Do you want to proceed?"

  7. #7
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Display Alerts in Access

    before that position, put in a line
    on error goto errorhandle

    at the end of the sub, on the line before End Sub add a few lines like
    VB Code:
    1. exit sub   ' so normally code will not go past
    2. errorhandle:      ' label to go to
    3. if err.number = xxxx  then resume next   , where xxxx is the number for the
    4. 'error  you are getting and resume next mean go back to the line after the error
    5.  
    6. ' here you would have conditions for other errors
    7. End Sub


    to go back to other errors not being processed by this error handler put
    on error goto 0

    pete

  8. #8

    Thread Starter
    Member
    Join Date
    May 2005
    Posts
    32

    Re: Display Alerts in Access

    I put an "on error goto errorhandle" line in my code before the error occurs. However, it still give me the same problem. The alert message is displayed BEFORE the program goes to the error handler. Is there no way to turn alerts off in Access?

    VO

  9. #9
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    Re: Display Alerts in Access

    There's an choice in the Options menu on the toolbar of Access to turn on/off warnings. FWIW, I think that in some cases that overrides normal error handling.
    The problem with turming off warnings is that will affect your whole app. It's probably possible to turn it off & back on through menubar commands, but I don't know the code for that offhand.
    But do you really want to turn it off? It would be a lot better to handle the error in some way.
    Tengo mas preguntas que contestas

  10. #10
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Display Alerts in Access

    Since this is a Insert or AddNew record error from the data being incomplete or incorrect, I dont think you can turn off that
    level of an error. Its best to fix the error.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  11. #11

    Thread Starter
    Member
    Join Date
    May 2005
    Posts
    32

    Re: Display Alerts in Access

    I agree that the error should be fixed. However, just for everyone's information, DoCmd.SetWarnings will enable or disable warnings in Access...

    Thanks for everyone's help,
    VO

  12. #12
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Display Alerts in Access

    It can also be accessed from the app object.
    VB Code:
    1. Application.DisplayAlerts = False 'Turn them off
    2. 'Do something that will invoke an error message
    3. Application.DisplayAlerts = True 'Turn it back on.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

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