Help Pleaes. Debug problem in MS Access 2003

  • Thread starter Thread starter nuages
  • Start date Start date
N

nuages

When I click the "Run Sub/UserForm (F5)" command in the VBA editor I
get a macro list. The code doesn't execute. The "Step Into (F8)"
command doesnt work either. What am I doing wrong?
 
nuages said:
When I click the "Run Sub/UserForm (F5)" command in the VBA editor I
get a macro list. The code doesn't execute. The "Step Into (F8)"
command doesnt work either. What am I doing wrong?

You can only run code directly with F5 if the sub/function does not
have any arguments. If the cursor is positioned in a Sub/Function that
has arguments, or if the cursor is in the empty space between two
procedures, then the macro list pops up. This is the Access standard.

If you want to run a Sub/Function that has arguments, you must do so
in the immediate window (Ctrl+G):

Public MyFunc(intX As Integer) As Integer
MyFunc = 2 * intX
End Function


? MyFunc(3)

6


HTH
Matthias Kläy
 
You can only run code directly with F5 if the sub/function does not
have any arguments. If the cursor is positioned in a Sub/Function that
has arguments, or if the cursor is in the empty space between two
procedures, then the macro list pops up. This is the Access standard.

If you want to run a Sub/Function that has arguments, you must do so
in the immediate window (Ctrl+G):

Public MyFunc(intX As Integer) As Integer
MyFunc = 2 * intX
End Function

? MyFunc(3)

6

HTH
Matthias Kläy
--www.kcc.ch

Thanks very much for quick reply. I now am more aware on how F5, F8
works. As it happens the the following procedure doesn't have
arguments and it works properly. But when I try and run it in the
Editor I still get a Macro list. Any ideas?

Option Compare Database
Option Explicit

Public Function faq_Open_Correct_Startup_Form()
'The purpose of this function procedure is to run the
'following sub procedure at startup.
sub_Open_Correct_Startup_Form
End Function
 
nuages said:
Thanks very much for quick reply. I now am more aware on how F5, F8
works. As it happens the the following procedure doesn't have
arguments and it works properly. But when I try and run it in the
Editor I still get a Macro list. Any ideas?

Option Compare Database
Option Explicit

Public Function faq_Open_Correct_Startup_Form()
'The purpose of this function procedure is to run the
'following sub procedure at startup.
sub_Open_Correct_Startup_Form
End Function

Sorry .. I forgot to mention that F5 only works in standard modules,
not in Form or Report or Class modules. You will have to call these
procedures from the immediate window too, e.g.

Call Forms("MyForm").faq_Open_Correct_Startup_Form

Greetings,
Matthias Kläy
 
Sorry .. I forgot to mention that F5 only works in standard modules,
not in Form or Report or Class modules. You will have to call these
procedures from the immediate window too, e.g.

Call Forms("MyForm").faq_Open_Correct_Startup_Form

Greetings,
Matthias Kläy
--www.kcc.ch- Hide quoted text -

- Show quoted text -

Problem solved! Thanks very much.
 
Back
Top