DoCmd.OpenReport OpenArgs error

JGravesNBS

Registered User.
Local time
Today, 15:20
Joined
Apr 5, 2014
Messages
58
This works:
DoCmd.OpenReport Me.QueryName, acViewPreview

Why am I getting Compile Error, named argument not found on the following?

DoCmd.OpenReport Me.QueryName, acViewPreview, OpenArgs:="Member Info Export"
 
Where I have a similar process in place, I find it works with
Code:
 DoCmd.OpenReport Me.QueryName, acViewPreview, "Member Info Export"
as opposed to
Code:
 DoCmd.OpenReport Me.QueryName, acViewPreview, OpenArgs:="Member Info Export"
 
I don't think you can combine arguments in that way, so it's a syntax issue.

either (with as many ,,,, as required)
DoCmd.OpenReport Me.QueryName, acViewPreview,,,,,,"Member Info Export"

or specify each argument

DoCmd.OpenReport Me.QueryName: windowmode:=acViewPreview, OpenArgs:="Member Info Export"

(It will be something like windowmode - not sure without checking.
 
After further review, found this at Allen Browne website

'Omit the last argument for Access 2000 and earlier. See note 4.
DoCmd.OpenReport strDoc, acViewPreview, WhereCondition:=strWhere, OpenArgs:=strDescrip

4. For Access 2000 and earlier, drop the OpenArgs:=strDescrip from the DoCmd.OpenReport line. In these versions, you can pass the description in a public string variable, and then use the Format event of the Report Header section to read the string and assign the value to an unbound text box.
 

Users who are viewing this thread

Back
Top Bottom