Ok I'm using Access 2003 and I've just started learning Access and VBA a few days ago.
I wrote some code in a module and there are no errors when I press the play button on the debugger toolbar up top.
How do I actually execute this code on my database so that it will do something.
In other words how do I make use of the module?
Please help me out I'm struggling hard and the deadline for this is thursday!
Thanks!
All VBA code in your Microsoft Access VBA programming environment is managed in an area known as the Visual Basic Editor (VBE) and can be accessible via a form, report or quickly by using the Alt + F11 function key from the keyboard.
A module is a collection of user-defined functions, subroutines, and global variables written in VBA code. These objects can then be used/called from anywhere in your Access database.
Well it depends on how you want to call this code.
Are you calling it from a button click on a form, if so then on the properties for the button on form, go to the Event tab, then On Click item, select [Event Procedure]. This will open the VBA code window for that button. You would then call your Module.Routine and then this would trigger when you click the button.
Similar to this:
Private Sub Command1426_Click()
mdl_ExportMorning.ExportMorning
End Sub
This button click event calls the Module mdl_ExportMorning
and the Public Sub ExportMorning
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With