• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 286
  • Last Modified:

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.

Thanks!
0
digitalwav
Asked:
digitalwav
  • 4
  • 3
1 Solution
 
OHDev2004Commented:
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
0
 
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
    objAccess.DoCmd.Maximize
    ' Show the Access window
    objAccess.Visible = True
0
 
OHDev2004Commented:
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 :)"
'Or
Report.Caption = Date
End Sub

Hope this Helps :)
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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.

Thanks!
0
 
OHDev2004Commented:
Your welcome ,,
thank you
OHDev2004
0
 
MutiswanCommented:
Digitalwav

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

0
 
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.
0
 
digitalwavIT Infrastructure ManagerAuthor Commented:
Never mind- I answered your question on one of your open questions that relates to this.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now