Solved

Passing a Report Title From VB to Access

Posted on 2004-04-26
8
280 Views
Last Modified: 2010-05-02
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
Comment
Question by:digitalwav
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 7

Expert Comment

by:OHDev2004
ID: 10923440
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
 
LVL 1

Author Comment

by:digitalwav
ID: 10927803
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
 
LVL 7

Accepted Solution

by:
OHDev2004 earned 500 total points
ID: 10930983
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
Technology Partners: 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!

 
LVL 1

Author Comment

by:digitalwav
ID: 10931353
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
 
LVL 7

Expert Comment

by:OHDev2004
ID: 10931374
Your welcome ,,
thank you
OHDev2004
0
 

Expert Comment

by:Mutiswan
ID: 11315523
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
 
LVL 1

Author Comment

by:digitalwav
ID: 11316083
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
 
LVL 1

Author Comment

by:digitalwav
ID: 11316180
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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question