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
Printable View
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
If it is directly in Access then it's quite simple:
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:
'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
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
Quote:
Originally Posted by RhinoBull
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
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. ;)