VB Editor Problem in Access 2000

P

Philip Axelroth

I am running Access 2000 (SP 3) under Windows 2000 (SP 4). When I attempt
to run a procedure from the VB Editor to test my code, the Macro Window
opens so I am not able to test and debug the code. Am I missing an options
setting somewhere within Access? Has anyone had this problem and have a
solution. Thanks for the help.

Philip Axelroth
AR Dept of Higher Education
 
B

Brendan Reynolds \(MVP\)

How are you trying to run the procedure? You can run a public procedure in a
standard module by typing its name in the Immediate window. To run a
function and print the return value to the Immediate window, precede the
function name with a '?' (shorthand for Debug.Print). Examples ...

MySub

? MyFunction()

It's been awhile since I've needed to do this, but I think you can probably
do the same with a public procedure in a form module, but (I'm not sure
about this bit) the form may have to be open at the time and you may have to
use the fully-qualified reference, e.g.

Forms!NameOfForm!NameOfSub

? Forms!NameOfForm!NameOfFunction()
 
P

Philip Axelroth

With the insertion point in the code, I select run sub/userform from the Run
menu. Then the macro window opens.

Phil Axelroth
 
D

Dirk Goldgar

Brendan Reynolds (MVP) said:
How are you trying to run the procedure? You can run a public
procedure in a standard module by typing its name in the Immediate
window. To run a function and print the return value to the Immediate
window, precede the function name with a '?' (shorthand for
Debug.Print). Examples ...

MySub

? MyFunction()

It's been awhile since I've needed to do this, but I think you can
probably do the same with a public procedure in a form module, but
(I'm not sure about this bit) the form may have to be open at the
time and you may have to use the fully-qualified reference, e.g.

Forms!NameOfForm!NameOfSub

? Forms!NameOfForm!NameOfFunction()

Small correction -- use the dot instead of the bang:

Forms!NameOfForm.NameOfSub

? Forms!NameOfForm.NameOfFunction()
 
D

Dirk Goldgar

Philip Axelroth said:
With the insertion point in the code, I select run sub/userform from
the Run menu. Then the macro window opens.

If your procedure requires arguments, it can't be run in this manner, so
the macro window opens to see what you might want to run. Also, event
procedures can't be run this way, so again, the macro window opens.
 
V

Van T. Dinh

See the thread "Pressing F5 in VBA Editor operates incorrectly?" in the
newsgroup "microsoft.public.access.gettingstarted" started by "Paul-M" on
Tuesday, 16 September 2003 01:32 (my date/time GMT + 10:00).
 
B

Brendan Reynolds \(MVP\)

Dirk Goldgar said:
Small correction -- use the dot instead of the bang:

Forms!NameOfForm.NameOfSub

? Forms!NameOfForm.NameOfFunction()

Small, but important! Thanks, Dirk.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top