msvisual.com Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

MS Access 2003 reports with parameters

 
Post new topic   Reply to topic    msvisual.com Forum Index -> VB Syntax
Author Message
elena



Joined: 04 Oct 2007
Posts: 9

PostPosted: Tue Feb 06, 2007 7:05 pm    Post subject: MS Access 2003 reports with parameters Reply with quote

Hi, All
I am using VB 6.0 front end and Access 2003 is back end, i created queries
with parameters and reports (data source are those queries), it works when i
double click on any report and then enter parameters in the prompt boxes,
How can i use my reports from VB application, i can print reports w/o
parameters
like this:
Set objAccess = New Access.Application
With objAccess
.DoCmd.OpenQuery strDB, acViewPreview, acReadOnly
.OpenCurrentDatabase (strDB)
.DoCmd.OpenReport strReportName
.DoCmd.Close acReport, strReportName
.Application.CloseCurrentDatabase
End With
If Not objAccess Is Nothing Then
objAccess.Quit
Set objAccess = Nothing
End If

Please, help where can i get some info on printing reports from VB and
reports data source are queries with parameters in Access 2003.

Thank you

Archived from group: microsoft>public>vb>syntax
Back to top
View user's profile Send private message
Paul Clement



Joined: 04 Oct 2007
Posts: 1560

PostPosted: Wed Feb 07, 2007 1:47 pm    Post subject: Re: MS Access 2003 reports with parameters Reply with quote

On Tue, 6 Feb 2007 14:05:00 -0800, elena wrote:

¤ Hi, All
¤ I am using VB 6.0 front end and Access 2003 is back end, i created queries
¤ with parameters and reports (data source are those queries), it works when i
¤ double click on any report and then enter parameters in the prompt boxes,
¤ How can i use my reports from VB application, i can print reports w/o
¤ parameters
¤ like this:
¤ Set objAccess = New Access.Application
¤ With objAccess
¤ .DoCmd.OpenQuery strDB, acViewPreview, acReadOnly
¤ .OpenCurrentDatabase (strDB)
¤ .DoCmd.OpenReport strReportName
¤ .DoCmd.Close acReport, strReportName
¤ .Application.CloseCurrentDatabase
¤ End With
¤ If Not objAccess Is Nothing Then
¤ objAccess.Quit
¤ Set objAccess = Nothing
¤ End If
¤
¤ Please, help where can i get some info on printing reports from VB and
¤ reports data source are queries with parameters in Access 2003.

You would need to specify the WhereCondition parameter in OpenReport. I'm not aware of any method to
pass parameters to the query data source using automation.


Paul
~~~~
Microsoft MVP (Visual Basic)
Back to top
View user's profile Send private message
elena



Joined: 04 Oct 2007
Posts: 9

PostPosted: Wed Feb 07, 2007 2:01 pm    Post subject: RE: MS Access 2003 reports with parameters Reply with quote

Thank you,

"elena" wrote:

> Hi, All
> I am using VB 6.0 front end and Access 2003 is back end, i created queries
> with parameters and reports (data source are those queries), it works when i
> double click on any report and then enter parameters in the prompt boxes,
> How can i use my reports from VB application, i can print reports w/o
> parameters
> like this:
> Set objAccess = New Access.Application
> With objAccess
> .DoCmd.OpenQuery strDB, acViewPreview, acReadOnly
> .OpenCurrentDatabase (strDB)
> .DoCmd.OpenReport strReportName
> .DoCmd.Close acReport, strReportName
> .Application.CloseCurrentDatabase
> End With
> If Not objAccess Is Nothing Then
> objAccess.Quit
> Set objAccess = Nothing
> End If
>
> Please, help where can i get some info on printing reports from VB and
> reports data source are queries with parameters in Access 2003.
>
> Thank you

Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
Parameter Reports (Access 2003 as Report Tool) I have VB6 as my front end, SQL2000 as my database and an Access Project for my report tool. I have a report that is based on a stored procedure with 2 parameters. How, when calling this report from VB6 can I send the required parameters? Here is the cod

Sql tmp table and reports Hi How can I use a temp table created in SQL Server 2000 as the basis for a report in Access? Thanks

Using "controls" on active reports in VB6 Hi, I can use this in a for next on a form easily : for i = 1 to 10 & "i").caption = "something" next i Instead, accessing controls on an Active Report, NO GO ? AR seems not to know what Controls is... Dim rpt as for

send a exe file, parameters Hello I need to send a program (.exe) parameters that it then will use within the program. What is the coding for this. Can this be done??? Please Help Mike

Optional parameters in user defined functions or subroutines OK, I know this is a really neophyte question, but is it possible to have "optional" paramters in user defined functions and subroutines (like the builtin ones do), or do you always have to pass something for each parameter. Mark
Post new topic   Reply to topic    msvisual.com Forum Index -> VB Syntax All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group