How Does OpenArgs Work?

  • Thread starter Thread starter S Jackson
  • Start date Start date
S

S Jackson

I posted this below but I think I failed to state it correctly I caused
confusion, so I apologize for a double post in advance, but I need an answer
on this.

Originally, I had a switchboard form that I created using the wizard. It
has two cmd buttons on it. I want both cmd buttons to open the same dialog
form (fdlgRegion). Then I want fdlgRegion to open either Form1 or Form2
depending on which cmd button the user selected on the Switchboard form.

***Since I think using a switchboard form created by the wizard is going to
cause too much trouble, I replaced it with a form I created from scratch
called fdlgStaff.***

So, now what? How do I use OpenArgs to tell fdlgRegion which form to open
based on the users selections on fdlgStaff?
TIA
 
You can pass the name of the "Form1" or "Form2" to the fdlgRegion form, and
then use it in a DoCmd.OpenForm action that is run from fdlgRegion.

When you open fdlgRegion and will want it to then open Form1:
DoCmd.OpenForm "fdlgRegion", , , , , acDialog, "Form1"

Then in fdlgRegion, use this:
DoCmd.OpenForm Me.OpenArgs
 
Thanks. I think I got it. Here is what I did:

Put this code behind the first cmd button on the Main dialog form:
DoCmd.OpenForm "fdlgRegion", , , , , , "frmSurveyors"

Put this code behind the second cmd button:
DoCmd.OpenForm "fdlgRegion", , , , , , "frmPMs"

Then this is part of the code for fdlgRegion:
DoCmd.OpenForm OpenArgs, , , stLinkCriteria

It works, but did I do it right?
TIA
 
Yes, although I'd use the Me object to qualify the OpenArgs in the last step
you posted:

DoCmd.OpenForm Me.OpenArgs, , , stLinkCriteria
 
Back
Top