Running Code

W

Wavequation

I would like to run some code, but I don't necessarily need it to be
associated with a form. Is there a way to run code from the VBA editor
window?
Thanks!
 
L

Linq Adams via AccessMonster.com

If you're talking about testing code, you can hit <Ctrl> + <G> and the
Immediate Window will appear at the bottom of the screen, Then typing in a
command that has producible results, preceded by a question mark will give
you results on the next line, so

?Date

will yield

8/11/2009

and

?2 + 2

will give you

4

So you can test (obviously more complicated then the examples) expressions
and functions to see if they work as expected.
 
W

Wavequation

What I really want to do is open up some recordsets and manipulate the data
in them. Can I run entire blocks of code without associating it with an
event of some sort?
 
D

Douglas J. Steele

Not really.

What I do is create a sub to do what I want in a stand-alone module, then
either run the sub from the Immediate Window, or else single-step through
it.
 
J

John W. Vinson

How do you run it in the immediate window, just type its name?

For a function, type

=Functionname(arguments)

For a sub, type

Call subname(arguments)
 
M

Michael J. Strickland

1. Put the code in a stand-alone module

2. Compile it (Debug->Compile).

3. Position the cursor anywhere inside the code, and hit F5(Run).
 
Top