Hi

This is for V9, should be same or similar in 8.5 though

Assuming you've gor the control on a form (Called it crView here) and have
the relevant references set up
----------------
Dim strReport As String
Dim dteDate As Date
Dim Appl As New CRAXDRT.Application
Dim Report As New CRAXDRT.Report

strReport =#Path and name of report#
'Open the report
Set Report = Appl.OpenReport(strReport)
'Connect to the relevant datasource
Report.Database.SetDataSource #Connection to Database#
Report.EnableParameterPrompting = True

'Use a date as the parameter
dteDate = Format(Now, "dd/mm/yyyy")
'Add to report as a parameter
Call Report.ParameterFields(1).AddCurrentValue(dteDate)

crView.ReportSource = Report
'Show the report
crView.ViewReport

DoEvents
'Print the report
'Report.PrintOut False, 1
----------------

Regards

MikeB

> -----Original Message-----
> From: mandy_vb6 [mailto:[EMAIL PROTECTED]
> Sent: 04 May 2005 03:54
> To: [email protected]
> Subject: [vbhelp] Opening Crystal Report from within VB
> 
> 
> I know this should be very simple but I am experiencing difficulty,  
> mostly just with plain syntax!  Does anyone have a code 
> snippet for me 
> that shows how to call a Crystal Report (V8.5) from within a 
> form in VB 
> and pass parameters to it.  Thanks so much!
> 
> 
> 
> 
> 
> '// =======================================================
>     Rules : http://ReliableAnswers.com/List/Rules.asp
>     Home  : http://groups.yahoo.com/group/vbHelp/
>     =======================================================
>     Post  : [email protected]
>     Join  : [EMAIL PROTECTED]
>     Leave : [EMAIL PROTECTED]
> '// =======================================================
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 



'// =======================================================
    Rules : http://ReliableAnswers.com/List/Rules.asp
    Home  : http://groups.yahoo.com/group/vbHelp/
    =======================================================
    Post  : [email protected]
    Join  : [EMAIL PROTECTED]
    Leave : [EMAIL PROTECTED]
'// =======================================================
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/vbhelp/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to