Re: Runtime error calls for macros that are Module subs





On Jan 25, 10:29 am, Matthias Klaey <m...@xxxxxxxxxxx> wrote:
"Hunter57" <Pwoo...@xxxxxxxxx> wrote:
This is really weird. All of my VBA subs run fine except for from the
VBA Editor Window (they even work in the Immediate Window). But
whenever I try to use the VBA Editor Window to run any sub in ANY
Access DB from in form module or any module I get an error--even with
simple subs like this:

Private Sub myTest(Cancel As Integer)
MsgBox "There is no data for this report. Canceling report..."
End Sub

This is what happens: A Macro Dialog box opens and lists Subs from
Modules are listed in the Macro Dialog box.

It does the same thing in databases that I download.

I am beginning to think I may need to reinstall or repair Access.

Can anybody help?

PatYou need to position the cursor in the Editor Window *within* the Sub
that you want to run. If the cursor is in the General Section (before
the first procedure) or at the end (after the last procedure) or
between procedures, the Macro dialog box pops up just as you describe,
since Access cannot know which procedure you want to run.

HTH
Matthias Kläy
--www.kcc.ch- Hide quoted text -- Show quoted text -

Thanks for your tip about not running a Public Sub or Function with
arguments. I appreciate your patience with a newbie.

Pat

.



Relevant Pages

  • Re: variable not recognised in embedded macro
    ... to have one sub inside another. ... there is another macro embeeded in the main macro at the end (before end ... that means when the cursor moves into the second macro the variable "symbol" ...
    (microsoft.public.excel.programming)
  • Re: Word Count
    ... A count, of somewhat dubious accuracy, is available through the macro ... display the Immediate window ... Sub SentenceCount() ...
    (microsoft.public.word.newusers)
  • Re: Word Count
    ... A count, of somewhat dubious accuracy, is available through the macro ... display the Immediate window ... Sub SentenceCount() ...
    (microsoft.public.word.newusers)
  • Re: Runtime error calls for macros that are Module subs
    ... VBA Editor Window. ... Private Sub myTest ... Modules are listed in the Macro Dialog box. ...
    (microsoft.public.access.modulesdaovba)
  • Re: variable not recognised in embedded macro
    ... you may not embed a Sub within another one. ... there is another macro embeeded in the main macro at the end (before end ... that means when the cursor moves into the second macro the variable ...
    (microsoft.public.excel.programming)

Loading