stuggling with OpenArgs

J

Judy Ward

I am opening frmDSSF_Subcontractor with OpenArgs (by clicking a button on
another form):
DoCmd.OpenForm "frmDSSF_Subcontractor", WhereCondition:="DSSF_ID=" &
Me.DSSF_ID, OpenArgs:=Me.DSSF_ID

I am checking the value of DSSF_ID before trying to open the form, so that's
not the problem. frmDSSF_Subcontractor opens to the correct record every
time.

In the Form_Load event of frmDSSF_Subcontractor, I am checking that
OpenArgs is not null (because I need to use this value). I put in Debug
statements and watch the Immediate window.

frmDSSF_Subcontractor does not know the value of OpenArgs every time. On
one click to open this form it doesn't. I close the form and immediately
click to open this form again--and this time it knows the value of OpenArgs.

Does anyone have any idea what is going on?

Thank you for your help,
Judy
 
P

Paul Shapiro

Was the form already open the first time? I believe the OpenArgs are only
set if your code is actually opening the form. You could add code to close
the form first if it's already open. Look for the IsLoaded property.

Or you could add a public method to the form code and use that to set the
property you want to pass.
 
D

Dennis

Judy,

Here is the response to the same question I asked earlier.



"Is the report already open? Even in design view?
If so, it already has its OpenArgs, so the new one won't get there.

I've not had much success with the Filter argument in recent versions of
Access. The WhereCondtion works. Or you can set its Filter in Report_Open
(and set FilterOn to True,)

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org. "


Here is the link to that discussion:

http://www.microsoft.com/communitie...&p=1&tid=b172fc46-88e4-4faf-9c30-19f13d4f7cee
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top