F5 and F8 not working in VBA

GregAcc

New member
Local time
Today, 23:08
Joined
Jun 25, 2020
Messages
13
Hi, I have a very basic problem, but I really don't how to run code with the f5 or f8 key. When I press f5 I could only get Macros dialog. Pressing the green Play button above makes no different??
Thanks
 
You do need to be in the correct Sub to use those keys.
Have you used Alt+F11 to get into the VB window first?
 
Yes I am in VB window with Alt F11. Could you try it on attached database?
 

Attachments

Sorry, I can't. I only have 2007 and it comes up as unrecognized format.
 
You're talking about in Excel, right? If so this should be in the Excel forum.

Anyway, is there any chance that you're trying to press F5 while your cursor is inside a procedure that takes parameters ?
Or, any function ?

Doing either of those will pop up the Macros dialogue, rather than running anything.
 
You're talking about in Excel, right? If so this should be in the Excel forum.

Anyway, is there any chance that you're trying to press F5 while your cursor is inside a procedure that takes parameters ?
Or, any function ?

Doing either of those will pop up the Macros dialogue, rather than running anything.
The o/p uploaded a DB ? :unsure:
 
The o/p uploaded a DB ? :unsure:
My mistake - I stand corrected. For some reason, I seem to often not see the visual cue on uploaded zip files to posts. Something about my color scheme maybe they just don't stand out.

Regardless, the rest of my post still stands, and applies here. The reason for the Macros dialogue box happens when your cursor is within a procedure that simply CAN'T be "run" just so.

An example would be the database OP posted which I just looked at - there aren't any non-form or non-control-related independent procedures. All there are are form class modules. The answer is OP simply cannot just "run" those subs. They are wired to events.

I've created a real independent procedure (the first one in the database that I can find anyway), called "Test". Put your cursor there and press F5, it works fine. Attached here.

Putting your cursor in procedures that are wired to form or control events (_click, _load, etc), and pressing F5 won't do anything other than display that box.
 

Attachments

Thank you Isaac, I could not open the DB due to my version of Access.
 
Thank you, Isaac.
So does that mean I can't test the code if it's associated with a form or if it has characters like (_click, _load, etc),?
Is there any other way to test code something like it is shown here in that video?
 
Thank you, Isaac.
So does that mean I can't test the code if it's associated with a form or if it has characters like (_click, _load, etc),?
Is there any other way to test code something like it is shown here in that video?
You would need to set a breakpoint in one of the events then use the form?
 
I figured out how to handle it. As you already said, first I need to put breakpoint and then trigger the event in a form that make a code process. So after that I just need to press button in a form and then can I continue with F8 key in VBA window.
 
Hi, I have a very basic problem, but I really don't how to run code with the f5 or f8 key. When I press f5 I could only get Macros dialog. Pressing the green Play button above makes no different??
Thanks
Try View/Toolbars/Debug and click on the green arrow for F5 and the icon on the right of the hand for F8. Not as easy as F5 or F8 but it works.
 

Users who are viewing this thread

Back
Top Bottom