Open the same form

T

ToniMaura

Win Xp. Access 2003.

Normally I open a form and when it loads (in Load Event) i made some changes
via openargs:
(Docmd. Openform "frmAny",,,,,,"New")

If I open the form declaring a variable ...

Private frmFormInst1 as Form frmAny
Set frmFormInst1= New frmAny
With frmFromInst1
.Visible=true
end with

... I could not pass the openargs argument, becouse in the Set instruccion
the load event executes...

How can i do it?
Thanks
 
D

dneagle via AccessMonster.com

ToniMaura said:
Win Xp. Access 2003.

Normally I open a form and when it loads (in Load Event) i made some changes
via openargs:
(Docmd. Openform "frmAny",,,,,,"New")

If I open the form declaring a variable ...

Private frmFormInst1 as Form frmAny
Set frmFormInst1= New frmAny
With frmFromInst1
.Visible=true
end with

... I could not pass the openargs argument, becouse in the Set instruccion
the load event executes...

How can i do it?
Thanks

Normally, the argument is passed from the first form to the second, like so

DoCmd.OpenForm stDocName, , , , , , Me.Text0

Then in the receiving forms Load event you would have

Me.Text1 = Me.OpenArgs

Where Text0 and Text1 are text boxes on forms 1 and two respectively.
 
Top