converting macros (1 Viewer)

S

segorese

Guest
I converted all my macros to modules and
then tried to use one command button
by pointing it to the function -- which does appear if you click on the ellipes.
The code can also be found in the Modules
tab.

When trying to run the command button using the module the system freezes up. The converted code is reproduced below.

I'm very new to coding. Does the freeze
up occur because of the Echo set to false
in the code? Is it because the macro
still exists in the Macro tab?

My macros all work so I'm puzzled as to
why the first conversion I tried has such
dismal results.

As I can only use this forum sparingly at work, can you direct any responses to

mailto:ses10@health.state.ny.us

Thank you for your time.

Steve Segore
Albany, NY USA

'------------------------------------------------------------
' mcr_open_main_switch
'
'------------------------------------------------------------
Function mcr_open_main_switch()
On Error GoTo mcr_open_main_switch_Err

' Closes open form and opens the main switchboard
DoCmd.Echo False, "Opening Main Switchboard"
' opens main switchboard
DoCmd.OpenForm "Main Switchboard", acNormal, "", "", acEdit, acNormal
DoCmd.Close acForm, "PLF Main"
DoCmd.Close acForm, "PLF Subform"
DoCmd.Close acForm, "Enrollment"
DoCmd.Close acForm, "Managed Care Only Lookup Form"
DoCmd.Close acForm, "PBII Information Form"
DoCmd.Close acForm, "PLF Main"


mcr_open_main_switch_Exit:
Exit Function

mcr_open_main_switch_Err:
MsgBox Error$
Resume mcr_open_main_switch_Exit

End Function
 

KDg

Registered User.
Local time
Today, 16:52
Joined
Oct 28, 1999
Messages
181
You need to turn the echo back on at the end of the code- ensure you also turn it on in the On Error - DoCmd.Echo True. Otherwise although Access is still running fine you've locked it.

You may also want to give your users an hourglass ( DoCmd.Hourglass True ) to let them know stuff is happening and then kill it at the end ( DoCmd.Hourglass False ). Again ensure that you include this in your On Error.

The Echo Method in the help has examples etc if you need more. It also recommends that you use Application.Echo True/False instead of the DoCmd as the DoCmd is only for backward compatability ( I've been reading the help file myself now, in case you can't tell )

HTH

drew

[This message has been edited by KDg (edited 01-21-2000).]
 

Users who are viewing this thread

Top Bottom