DoCmd.OpenReport OpenArgs error (1 Viewer)

JGravesNBS

Registered User.
Local time
Today, 08:00
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"
 

Alc

Registered User.
Local time
Today, 11:00
Joined
Mar 23, 2007
Messages
2,407
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"
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 16:00
Joined
Sep 12, 2006
Messages
15,728
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.
 

JGravesNBS

Registered User.
Local time
Today, 08:00
Joined
Apr 5, 2014
Messages
58
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

Top Bottom