R
Ron Hinds
I've been developing with Access '97 for quite some time. But now that we've
moved all of our customers to Access 2003 I'm going to do all of the
development with that tool. I have a macro which worked great in '97. The
macro was invoked by using the keystroke combination Ctrl-E. In a macro
named Autokeys, the Macro Name is ^e and the action is the name of a Public
Sub in a Module. When invoked with Ctrl-E while the cursor was positioned on
the declaration line of a new Sub or Function (either in a Module or a
Form's Class Module, etc.) it would create a skeleton declaring certain
variables and defining the error handler, etc., like so:
Public Function GetCouponCode(Invoice As Long) As String
On Error GoTo Error_GetCouponCode
Dim db As Database
Dim strSQL As String
Dim rs As Recordset
Set db = DBEngine(0)(0)
Exit_GetCouponCode:
Exit Function
Error_GetCouponCode:
msgbox Error, vbCritical, "Error " & err & " - GetCouponCode"
Resume Exit_GetCouponCode
End Function
When I try to invoke the macro with Ctrl-E in Access 2003, an Export File
dialog pops up. Fine, I thought, just a conflict wiht that key combination,
so I changed the Maro Name to ^+e, which should change the keystroke to
Ctrl-Shift-E. Nothing happens when I type that keystroke in a module.
Interestingly, if I am in the main Access 2003 window, that keystroke *does*
invoke the function defined as the Action for the macro, but with disastrous
results since I'm not in a Code Window. It seems that now that the Code
"Window" is actually a separate process, it is ignorant of any macros
defined in the main access window. So, how do I define a macro that works in
the Code process? I've tried using the Help system to find out, but,
frankly, the new Help system SUCKS (that's for another post)!
moved all of our customers to Access 2003 I'm going to do all of the
development with that tool. I have a macro which worked great in '97. The
macro was invoked by using the keystroke combination Ctrl-E. In a macro
named Autokeys, the Macro Name is ^e and the action is the name of a Public
Sub in a Module. When invoked with Ctrl-E while the cursor was positioned on
the declaration line of a new Sub or Function (either in a Module or a
Form's Class Module, etc.) it would create a skeleton declaring certain
variables and defining the error handler, etc., like so:
Public Function GetCouponCode(Invoice As Long) As String
On Error GoTo Error_GetCouponCode
Dim db As Database
Dim strSQL As String
Dim rs As Recordset
Set db = DBEngine(0)(0)
Exit_GetCouponCode:
Exit Function
Error_GetCouponCode:
msgbox Error, vbCritical, "Error " & err & " - GetCouponCode"
Resume Exit_GetCouponCode
End Function
When I try to invoke the macro with Ctrl-E in Access 2003, an Export File
dialog pops up. Fine, I thought, just a conflict wiht that key combination,
so I changed the Maro Name to ^+e, which should change the keystroke to
Ctrl-Shift-E. Nothing happens when I type that keystroke in a module.
Interestingly, if I am in the main Access 2003 window, that keystroke *does*
invoke the function defined as the Action for the macro, but with disastrous
results since I'm not in a Code Window. It seems that now that the Code
"Window" is actually a separate process, it is ignorant of any macros
defined in the main access window. So, how do I define a macro that works in
the Code process? I've tried using the Help system to find out, but,
frankly, the new Help system SUCKS (that's for another post)!