[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


access 2007 and crystal reports 8

Posted on 2011-10-28
Medium Priority
Last Modified: 2012-05-12
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.
Question by:centralmike
LVL 28

Expert Comment

ID: 37049607
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
LVL 101

Accepted Solution

mlmcc earned 2000 total points
ID: 37050228
You have to use the viewer inside Access or call a third-party tool

Is this Crystal 8 or Crystal 2008 you are using?


Author Comment

ID: 37051548
I am usine crystal 2008
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

LVL 101

Expert Comment

ID: 37051672
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.

LVL 21
ID: 37097278
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.  
LVL 21
ID: 37097311
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


Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The canonical version of this article is on my web site here: http://iconoun.com/articles/collisions/ A companion presentation is available here: http://iconoun.com/articles/collisions/Unicode_Presentation.pdf
The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question