Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

open crystal report in access form 1

Status
Not open for further replies.

Hueby

MIS
Oct 20, 2004
321
US
Hi all, Can I add a button on in my access form, and have it open a crystal report I made???? Would some code in the On_Click event do this?? Thanks!
 
Hueby,

You did not specify which version, but this may work for you..

Daniel said:
Possibly try this:

The following steps show how to preview a report in Microsoft Access 2000:


1. Open Microsoft Access and create a new form using 'Design View'.

2. Under the 'Insert' menu, click 'ActiveX Control…'. The 'Insert ActiveX Control' box appears.

3. Select 'Crystal Report Control' and click 'OK'. The OCX control appears on the form.

4. Right-click the OCX control and select 'Properties', then Click the 'Other' tab.

5. Change the 'Name' property to 'CrystalReport1' (without quotes) and set the 'ReportFileName' property to the path of a report file (such as C:\Program Files\Seagate Software\Crystal Reports\Samples\En\Reports\Feature Examples\Formulas.rpt). You can use the ellipsis (…) button to browse to a report.

6. Using the Access Toolbox, place a command button on the form. Click 'Cancel' when the 'Command Button Wizard' appears.

7. Right-click the command button and select 'Properties'. Click the 'Format' tab and set the 'Caption' property to 'Preview Report' (without quotes).

8. Click the 'Event' tab, and set the 'On Click' event to [Event Procedure] from the drop-down combo box.

9. Next to the drop-down arrow, click the ellipsis (…) button. The Visual Basic editor appears.

10. In the Command1_Click() event, type the following line of code:

CrystalReport1.Action = 1

This line previews the report when the button is clicked.

11. Back in the form's design view, save and then view the form. Click the command button to preview the report.

HTH


Daniel


I hope this helps... [thumbsup2]


 
I'm using CR 10 and Access 03. I'll try that method! thanks
 
Wel.. it seems to be close to what I need. however I get a error on the "CrystalReport1.action = 1" code in the VB editor.. not sure what is going on...
 


It may be case-sensitive...

Use
CrystalReport1.Action = 1
not
CrystalReport1.action = 1

Sorry I do not have Crystal Reports...

 
Anyone else have any ideas on this subject? thanks
 
Here's a sample of code that is used in one of my applications:
Private Sub cmdPaid_Click()
Screen.MousePointer = vbDefault
Dim crxDatabaseTable As CRAXDRT.DatabaseTable
Dim crxParameterField As CRAXDRT.ParameterFieldDefinition
Dim crxFormulaField As CRAXDRT.FormulaFieldDefinition
Set Report = crxApplication.OpenReport _
("E:\PLTERA\CRYSTAL REPORTS\HAULER REPORTS\paid.rpt", 1)
frmViewer.Show vbModal

ErrHandler:
' User pressed Cancel button.
Exit Sub
End Sub
Good Luck
Cathy
 
Sorry about my post up above - I have tunnel vision and gave you code for VB.
Cathy
 
Heh, it's okay! I'll give a few more stabs at this for Access.. I already just wrote a small VB app to open it for now. Thanks everyone
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top