Passing a Report Title From VB to Access

I am using Access for reporting from a VB app. All works great, the query is passed, Access opens and we get the report.  What I'd like is to be able to adjust the report title on the fly-  for example:
Weekly reports run on a specific date range. That date range should be in the title, to identify this report from last weeks report.

digitalwavIT Infrastructure ManagerAsked:
Who is Participating?
look man there is no way to do this within VB if you call the Report and it's stored in the DB

so there is another trick within ACCESS and its vb code also :)
in the designview of the report - RightCLICK then from the Menu choose "Build Event"
then choose "Code"
then write this part of code as you want it :

Private Sub Report_Open(Cancel As Integer)
Report.Caption = "Blablabla :)"
Report.Caption = Date
End Sub

Hope this Helps :)
this should be changed in the report in the Database not for access ,
if you want to change it in VB ,, how do you view the report ? Datareport ? or what
just provide extra Info .... OHDev2004
digitalwavIT Infrastructure ManagerAuthor Commented:
This is the code used to open Access w/ the query parameters etc. What I want to know is if there is a way to name the report at this point.

'open access and display selected report
Set objAccess = New Access.Application
    objAccess.OpenCurrentDatabase DatabaseLocation
    'Give acViewPreview to preview the report.
    objAccess.DoCmd.OpenReport ReportName, acViewPreview, , ReportWhereCondition
    ' Maximize the report window
    ' Show the Access window
    objAccess.Visible = True
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

digitalwavIT Infrastructure ManagerAuthor Commented:
That's what I ended up doing. I pasted the code from VB that was calculating the dates and now things matched up.

Your welcome ,,
thank you

Following your question that you published on experts-exchange on 04/26/2004 with Question Title"Passing a Report Title From VB to Access" you wrote -

 "I am using Access for reporting from a VB app. All works great, the query is passed, Access opens and we get the report.  e.t.c"

I think you can solve the problem that i have. I have an application running on
VB and Access as the Backend. I want to develop reports in access and run then from VB. Please help me with the code. I need my reports to use Queries from VB application.

e.g I have a table of Cassettes and i only want to display on my report only cassettes of a particular Author.

Select * From TableName Where actor="ActorName"

I need to pass my query.

Please help

digitalwavIT Infrastructure ManagerAuthor Commented:
Start a new question in the VB area with some points and I'll be happy to pass you the necessary info!

I've done this successfully several time.
digitalwavIT Infrastructure ManagerAuthor Commented:
Never mind- I answered your question on one of your open questions that relates to this.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.