|
-
Jun 27th, 2005, 11:07 AM
#1
Thread Starter
Frenzied Member
Generating and loading report
Hi every body. I wonder how i can generate and load a report when a button is clicked on access 2000 form. I be happy if some one show me an example.Thanks
-
Jun 27th, 2005, 01:17 PM
#2
Re: Generating and loading report
If it is directly in Access then it's quite simple:
VB Code:
'place command button on the form, dblclick on it
'and assign some event procedure similar to the following
Sub Button1_Click()
DoCmd.OpenReport "Employee Sales by Country",acViewPreview
End Sub
If you need to run report from outside the Access (say from VB6 application) then you'll have to do automation. Here is a quick sample:
VB Code:
Public Sub RunAccessReport(strDB As String, strReport As String, _
Optional strFilter As String = "", _
Optional strWhere As String = "")
'===================================================================
Dim AccessDB As Object
Set AccessDB = CreateObject("Access.Application")
AccessDB.OpenCurrentDatabase strDB
AccessDB.DoCmd.OpenReport strReport, acViewPreview, strFilter, strWhere
AccessDB.Visible = True
Set AccessDB = Nothing
End Sub
-
Jun 27th, 2005, 02:30 PM
#3
Thread Starter
Frenzied Member
Re: Generating and loading report
 Originally Posted by RhinoBull
If it is directly in Access then it's quite simple:
VB Code:
'place command button on the form, dblclick on it
'and assign some event procedure similar to the following
Sub Button1_Click()
DoCmd.OpenReport "Employee Sales by Country",acViewPreview
End Sub
If you need to run report from outside the Access (say from VB6 application) then you'll have to do automation. Here is a quick sample:
VB Code:
Public Sub RunAccessReport(strDB As String, strReport As String, _
Optional strFilter As String = "", _
Optional strWhere As String = "")
'===================================================================
Dim AccessDB As Object
Set AccessDB = CreateObject("Access.Application")
AccessDB.OpenCurrentDatabase strDB
AccessDB.DoCmd.OpenReport strReport, acViewPreview, strFilter, strWhere
AccessDB.Visible = True
Set AccessDB = Nothing
End Sub
Thank u for u reply. is your code all in in access 2000 and vba? i want to generate and load same report from withing access.Thanks
-
Jun 27th, 2005, 08:14 PM
#4
Re: Generating and loading report
I don't know how to explain and/or present any better but I did give you exact answer you're looking for so read it through my post once again and try to determine what's for you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|