access 2007 and crystal reports 8

Is there any way to have a command button from microsoft access(2007) launch a crystal report8.  I tried the shell command did not work. It only opened the crystal product did not launch the report.
Who is Participating?
mlmccConnect With a Mentor Commented:
You have to use the viewer inside Access or call a third-party tool

Is this Crystal 8 or Crystal 2008 you are using?

Don't have crystal to try, but I expect you could create a batch file to open the report, then fire that with Access.

Chris B
centralmikeAuthor Commented:
I am usine crystal 2008
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

I don't believe CR2008 can be called from Access.  CR2008 only supports a .Net interface.

You will have to use an application that can be called from Access to produce the reports.

Boyd (HiTechCoach) Trimmell, Microsoft Access MVPCommented:
What I have learned is that in CR 2008 there is no RDC.  The RDC object model has been retired. This means you can no longer use it with VBA.   The recommended/suggested migration path is to use the Crystal Reports .NET SDK.  
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPCommented:
I did find this VBScript that you may be able to use:

Dim App, RptFile, User, Comp, Pw, Dest, RptSelect
Dim Rept, Login, ExportFile, ParamFields, Year


' **** SET VARIABLES ********************************************************************************
'Report File: Change to the full path and file name
RptFile = "<full_path_to_report.rpt>"

'Export File: Change to the full path and file name
ExportFile = "<full_path_to_export_file.csv>"

'Login Info, you may want to setup a dummy user for all of this.
User = "user"
Comp = "company"
PW = "password"

'Destination Export, Print or Preview - set it to 2 to Export, 1 to Print
Dest = 2

Set App = CreateObject ("CrystalRuntime.Application")
Set Rept = App.OpenReport (RptFile)
Login = App.LogOnServerEx("p2sodbc.dll", "<YOUR_DSN_NAME>", , , , , "DSN=<YOUR_DSN_NAME>; UID="+User+"; PWD="+PW+"; Company="+Comp)

' **** SET EXPORT OPTIONS ********************************************************************************
'crEFTNoFormat 0
'crEFTCrystalReport 1
'crEFTDataInterchange 2
'crEFTRecordStyle 3
'crEFTRichText 4
'crEFTCommaSeparated-Values 5
'crEFTTabSeparatedValues 6
'crEFTCharSeparatedValues 7
'crEFTText 8
'crEFTTabSeparatedText 9
'crEFTPaginatedText 10
'crEFTLotus123WKS 11
'crEFTLotus123WK1 12
'crEFTLotus123WK3 13
'crEFTWordForDOS 15
'crEFTQuattroPro50 17
'crEFTExcel21 18
'crEFTExcel30 19
'crEFTExcel40 20
'crEFTExcel50 21
'crEFTExcel50Tabular 22
'ODBC not permitted 23
'crEFTHTML32Standard 24
'crEFTExplorer32Extend 25
'crEFTNetScape20 26

Rept.ExportOptions.DiskFileName = ExportFile
Rept.ExportOptions.DestinationType = 1
Rept.ExportOptions.FormatType = 5 ' 5 IS FOR COMMA-SEPARATED FORMAT
Rept.ExportOptions.CharFieldDelimiter = ""
Rept.ExportOptions.CharStringDelimiter = ""

' **** HANDLE USER INPUT AND REPORT PARAMETERS **********************************************************
'batchNumber= UserInput( "Enter Batch Number" )
'WScript.Echo "You entered: " & batchNumber

'beginInvNumber= UserInput( "Enter Beginning Invoice Number" )
'WScript.Echo "You entered: " & beginInvNumber

'endInvNumber= UserInput( "Enter EndingInvoice Number" )
'WScript.Echo "You entered: " & endInvNumber

Rept.ParameterFields.GetItemByName("BatchNo").AddCurrentvalue UserInput( "Enter Batch Number" )
Rept.ParameterFields.GetItemByName("BegInvNbr").AddCurrentvalue UserInput( "Enter Beginning Invoice Number" )
Rept.ParameterFields.GetItemByName("EndInvNbr").AddCurrentvalue UserInput( "Enter EndingInvoice Number" )

' **** FINALIZE OPTIONS **********************************************************

If Not IsNull(Rept.ReportTitle) then
RptWindow = Rept.ReportTitle
RptWindow "Crystal Reports"
end If

If Dest = 1 then
End If

If Dest = 2 Then
End If

' **** AWAY WE GO **********************************************************
set WshShell = WScript.CreateObject("WScript.Shell")
While WshShell.AppActivate(RptWindow) = TRUE
wscript.sleep 10000

Set WshShell=Nothing
Set Rept=Nothing
Set App=Nothing 

WScript.Echo "Invoice Export Process Completed"

' **** FUNCTIONS SECTION ****************************************************************************************

Function UserInput( myPrompt )
' This function prompts the user for some input.
' When the script runs in CSCRIPT.EXE, StdIn is used,
' otherwise the VBScript InputBox( ) function is used.
' myPrompt is the the text used to prompt the user for input.
' The function returns the input typed either on StdIn or in InputBox( ).
' Check if the script runs in CSCRIPT.EXE
If UCase( Right( WScript.FullName, 12 ) ) = "\CSCRIPT.EXE" Then
' If so, use StdIn and StdOut
WScript.StdOut.Write myPrompt & " "
UserInput = WScript.StdIn.ReadLine
' If not, use InputBox( )
UserInput = InputBox( myPrompt )
End If
End Function 

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.