OpenArgs problem I think

C

CD Tom

Not to sure what's happening but I've started using the OpenArgs option in
the Docmd.openform and now the criteria doesn't seem to be working. Is there
a problem when using the Openargs statement? the docmd looks like this
DoCmd.OpenForm stDocName, , , StLinkCriteria, , ,OpenArgs:=VRecordSource
the stLinkCriteria is set to Dept = 1 or 2 depending on the Dept and the
Vrecordsource is the record I want to use. I'm using the same form with
different recordsources. Thanks for any help.
 
K

Ken Snell MVP

OpenArgs passes a string value to the form being opened, but unless you have
code in that newly opened form that reads the OpenArgs property and does
something with it, it has no effect on the criteria. Without seeing more of
your code, it's impossible to give any suggestions for what may be happening
here.
 
S

Stuart McCall

CD Tom said:
Not to sure what's happening but I've started using the OpenArgs option in
the Docmd.openform and now the criteria doesn't seem to be working. Is
there
a problem when using the Openargs statement? the docmd looks like this
DoCmd.OpenForm stDocName, , , StLinkCriteria, , ,OpenArgs:=VRecordSource
the stLinkCriteria is set to Dept = 1 or 2 depending on the Dept and the
Vrecordsource is the record I want to use. I'm using the same form with
different recordsources. Thanks for any help.

I think the problem here is that you're attempting to mix positional
arguments with named ones. That line ought to read either:

DoCmd.OpenForm FormName:=stDocName,
WhereCondition:=StLinkCriteria,OpenArgs:=VRecordSource

(that should be all one line of course)

or:

DoCmd.OpenForm stDocName, , , StLinkCriteria, , ,VRecordSource
 

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