Share via

Restart Access using VBA?

Anonymous
2011-04-27T17:37:37+00:00

Hi. I'm using the old MSAccess which is Access 2003. I want to know if it is possible to restart Access using VBA. I've tried searching over the web but I can't find anything useful. This is to trap some errors wherein it is required to restart the application to run smoothly.

Hoping for your response.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2011-05-04T15:20:37+00:00

Okay, so that makes sense.  What appears to be happening is that you have an unhandled error which then you go to debug and instead of sliding the yellow area down to the next line so it will bypass it and continue running you click the STOP DEBUG button and then you lose a global variable which apparently has your connection to SQL Server (or some other data source) open.

So what you need to do is to handle the errors and if you stop to debug, you can just, over on the left hand side of the VBA window, on the yellow line, drag the yellow arrow which points to the code that needs fixing down to the next executable line of code or down to the exit spot of the procedure.  Then click F5 to continue running and then go back and fix it.

To fix your code you showed, just use

If Val(Nz(txtValue, 0)) < 0 Then

...etc.

Was this answer helpful?

0 comments No comments

11 additional answers

Sort by: Most helpful
  1. Anonymous
    2011-04-29T03:47:14+00:00

    Seems like restarting is not an easy task. Well I just need it so that I, as a developer, will not manually restart the application. It saves my time clicking or pressing keys. Lazy stuffs right? lol

    Thanks for the reply.

    Regards,

    Michael

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2011-04-28T00:11:09+00:00

    Sounds like we should fix your code (it is that which is the problem, and restarting just obscures that).

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2011-04-28T00:02:02+00:00

    I'm not sure I get what you mean by restarting because of some errors.  What errors are you experiencing?  You shouldn't have to restart Access to fix that so it would help if you gave specific error messages.

    I'm using ADODB Recordset to filter and search specific records. By using "On Error Goto" Statement, I'm able to trap errors, like null strings, invalid computations, etc. Then when I resume or execute next call for query, it always show errors wherein the query will not work. Restarting the application helps.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2011-04-27T18:48:44+00:00

    I'm not sure I get what you mean by restarting because of some errors.  What errors are you experiencing?  You shouldn't have to restart Access to fix that so it would help if you gave specific error messages.

    Was this answer helpful?

    0 comments No comments