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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Date Parm from VB6 to CR Report Header

Status
Not open for further replies.

traceytr

Programmer
Mar 13, 2001
94
0
0
US
Hi,

I'm using the Crystal Active X control in VB6, and my Crystal Report works - pulling only the date range selected with the date picker in VB. Am trying now to put the selected date range on the report header (This is my first Crystal Report. I've done a few in Access but NEVER passed parms from VB.)

I created a formula field in the report header. I hope I did it right. All it says is "@ReportFilter", which is what I named it. Moving slowly on to the next step... how do I get VB to pass the first date (dtFrom.Value) and the second date (dtTo.Value) into a string which says for example "Date Range: 6/12/00 through 7/30/00".

Keep in mind I'm very new so basic instruction is appreciated. Thanks.

Tracey
 
You can try this one:

Private Sub cmdPrint_Click()
Dim strHeader As String
Dim indx As Integer
On Error GoTo BadPrinting
strHeader = "Date Range: " & dtFrom.Value & " Through " & dtTo.Value

'ReportHeader is declared in CR as parameter field
crptMyReport.ParameterFields(0) = "ReportHeader;" & strHeader & ";True"
crptMyReport.Action = 1
Exit Sub

BadPrinting:
indx = MsgBox(Err.Description, _
vbInformation + vbOKOnly)
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top