Generic Functpon to Open a Form

  • Thread starter Thread starter JamesJ
  • Start date Start date
J

JamesJ

I want to use the RunCode command in a macro to open a form in design view.
But I want to call it from all my forms from a shortcut menu.
For testing purpose I sinmly call this temporarily from a command button on
a form.

I get an error 2498:
'An expression you entered is the wrong data type for one of the arguments'
(what ever that means)

Function DesignView()

Dim fm As Form

Set fm = Screen.ActiveForm

DoCmd.OpenForm fm, acDesign

End Function

Ant help will be appreciated,
James
 
I want to use the RunCode command in a macro to open a form in design view.
But I want to call it from all my forms from a shortcut menu.
For testing purpose I sinmly call this temporarily from a command button on
a form.

I get an error 2498:
'An expression you entered is the wrong data type for one of the arguments'
(what ever that means)

Function DesignView()

Dim fm As Form

Set fm = Screen.ActiveForm

DoCmd.OpenForm fm, acDesign

End Function

Ant help will be appreciated,
James

The first argument to the OpenForm method is a Text string (the name of the
form), not a Form object. Try

DoCmd.OpenForm fm.Name, acDesign
 
Works fine now.

Thanks much,
james

John W. Vinson said:
The first argument to the OpenForm method is a Text string (the name of
the
form), not a Form object. Try

DoCmd.OpenForm fm.Name, acDesign
 
Back
Top