Variable from VB to Access Report

vbjohn

Registered User.
Local time
Today, 17:53
Joined
Mar 22, 2002
Messages
75
How can you add a variable from VB to an Access Reports Page Header?

Any suggestions?


John-
 
When opening the report with code assign the variable to the report's OpenArgs property.

Then, on the OnOpen() event of the report assign the reports OpenArgs to the control in the header that you wish to display the variable's value.
 
This is how I am opening the report...

=========================================
Private appAccess As Access.Application

Set appAccess = New Access.Application
strACCond = "((APHistory.POSTEDDT) Between #" & txtFDate.Text & "# And #" & txtTDate.Text & "#)"

appAccess.Visible = False
appAccess.OpenCurrentDatabase App.Path & "\APHistory.mdb", True

With appAccess.DoCmd
.OpenReport "Aphistory", acViewPreview, , strACCond
.Maximize
End With

appAccess.Visible = True

=========================================

So where is the OpenArgs in VB or Access?


John-
 
If you look at the information of all the arguments in the DoCmd.OpenReport statement - where it goes:FormName, [Filter], etc you'll see that OpenArgs is the last argument and you'd just put the variable's name there.
 
All I see is..

.OpenReport [Report Name], [View As AcView = acViewNormal],[Filtername],[WhereCondition]

John-
 
Strange...
 

Attachments

  • untitled.jpg
    untitled.jpg
    21.1 KB · Views: 181
what version of vb, access do you have? What refrence do you use in VB? "Microsoft Access 9.0 Object Library".


John-
 

Attachments

  • vbcode.gif
    vbcode.gif
    6.1 KB · Views: 172
Ah! As I'm at home I'm using A2002 - forms in A97 can be opened with OpenArgs passed so I'd have thought reports had that same property.
 

Users who are viewing this thread

Back
Top Bottom