Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Microsoft: Access Modules (VBA Coding) FAQ

Error Resolution

How to debug your code by dhookom
Posted: 9 Mar 09

Few if any of us write code that is accurate and logical 100% of the time. If your code doesn't work as expected, you need to be able to debug it.

For instance, if one of the early lines of your code is:


   stQueryName = Me.[cmbQueryName]
and it doesn't seem to be working correctly, you have at least three options for trouble-shooting.

Adding a breakpoint is as simple as clicking in the vertical bar to the left of a line of executable code.


|o|  stQueryName = Me.[cmbQueryName]
The code will stop running and allow you to hover the mouse over a variable to see its value. You can press [F8] to step through the code a line at a time. [F5] will run to the end of the procedure.

The following will put the value in the debug window:


   stQueryName = Me.[cmbQueryName]
   Debug.Print "stQueryName: " & stQueryName
You can press Ctrl+G to open the debug window to view the results of the statement.

The following will stop the code execution and display the value in a message box:


   stQueryName = Me.[cmbQueryName]
   MsgBox "stQueryName: " & stQueryName

Back to Microsoft: Access Modules (VBA Coding) FAQ Index
Back to Microsoft: Access Modules (VBA Coding) Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close