Solved

Passing a Report Title From VB to Access

Posted on 2004-04-26
8
279 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
  • 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA Shell can't Find Word document 11 112
IF ELSE Statement in Excel Macro VBA 16 75
Error with a code discussed on this page 5 32
transition to visual .net from vb6 5 41
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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 process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

829 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