I work in the Access IDE, (Integrated Development Environment), all day and it helps to know a few tricks or ten on how to take advantage of the environment.
10. Before you can fix your code you need to break it first.
Who among us can write perfect code every time on our first try? That’s why I always break new code when I run it for the first time, stepping through it so I know it’s working as I designed it. You can break your code by clicking on the left border of the IDE and inserting a red break point. Use F8 to step through or F5 to run it at normal speed.
9. Immediate Window
Control-G quickly became my favorite way to get to the Access immediate window where you can work wonders:
You can do math, for example, type ?5*2 and the compiler responds 10.
I can even run functions and re-assign variable values, below I ask the system for the value of my variable strSQL, then I re-assign a value, (notice you don’t use the ? when assigning values), then I ask again for the new value of the variable:
8. Find and Replace Globally
Control-F will bring up the search dialog, where you can limit the search to just the current procedure, module or all of your code. Control-H will bring up the search and replace dialog box. Handy if you need to do a global replace in the current procedure for a variable name, constant, etc.
7. Move the execution point
You can drag the yellow arrow when debugging your code, just grab the yellow arrow on the left and move it up or down, great when you want to re-run a block of code again.
6. Dual Windows
Sometimes I need to see the list of variables at the top of my procedure as I’m adding new lines of code. That can be a problem if I have a long procedure and my declaration area is gone from the top. That’s when this tip comes in handy: Just move your cursor to the upper right hand top of the vertical scroll bar, until it turns into double arrow, then click and drag to create a split view of your screen.
You will then see two panes where you can display different lines from the same module:
To go back to just one pane double click on on the horizontal pane border.
5. Bookmark your way back
Bookmarks are a great way to tag your line of code, go somewhere else and quickly come back. You can insert a bookmark by clicking the bookmark icon on the edit toolbar:
The only drawback is you lose the bookmarks you’ve created once Access is closed down.
4. Explorer your code
Press Ctrl-R to view the explorer window where you can double click on any object to see their code.
3. Right click to find definitions
You can see a variable’s declaration or see the code behind a subroutine or function by right clicking on them and selecting “Definition”.
2. Leave yourself a non-comment
Sometimes I need to abandon incomplete code to work on another project. I got tired of figuring out where I had left off, (is it the onset of senility or information overload?), so now I deliberately leave a non-comment that will cause the compiler to error out: CONTINUE HERE is one of my favorites. When I get back I just compile the project and Access takes me where I left off. I erase the comment and keep going.
And my number one tip is…
1. Get the white out
I stare at my screen all day and the default white background of the IDE was killing me, that is until I discovered how to change it. Below is how my IDE looks, the beep blue background makes it very easy on the eyes. You can change the appearance by clicking on Tools, Options and then clicking on the Editor Format tab. Notice how keywords such as Dim and String are in green, making it easier to view your code.
In a future post I’ll be discussing my top annoyances about the IDE and close out the series with some of my favorite tools for Access developers.
What is your number one favorite IDE feature? Submit a comment below for a chance to win a $25 Amazon gift card!