The following code may help you. Define a formula field called Heading in
the crystal report and place it on the report.
Dim s, s1 As String
On Error GoTo Errmsg
s = "Select * from Table where Receiptdate between '" & FromDate.Text &
"' and '" & ToDate.Text & "' order by invoicedate"
Report1.SQLQuery = s
s1 = "Invoice Register for the period " & FromDate.Text & " To " &
ToDate.Text
Report1.Formulas(1) = "Heading='" & s1 & "'"
Report1.Action = 1
Exit Sub
Errmsg:
MsgBox Err.Number & " -" & Err.Description
Regards,
Anita
-----Original Message-----
From: Richard Ainsley [mailto:rainsley@p...]
Sent: Friday, July 26, 2002 8:24 AM
To: professional vb
Subject: [pro_vb] Re: Header from VB to Crystal
SQL Books help does not recognize the to_date() function. If your date is
aleady in the default system date format as a string -- just use the string
itself and drop the to_date() function which likely not available to your
SQL server...
----- Original Message -----
From: "OB" <oby.atabansi@h...>
To: "professional vb" <pro_vb@p...>
Sent: Thursday, July 25, 2002 12:29 PM
Subject: [pro_vb] Header from VB to Crystal
> Help please. I am using the below query to generate a report. The report
> in CR8.5 has a report header that should capture the users entry 'from'
> and 'to' dates. It should say.."Report from '06/05/02' to '07/24/02'.
> How do I go about coding this and capturing this heading?
>
> Dim Start_Date As Date
> Dim End_Date As Date
> Start_Date = CDate(Me.txtRptDteFrom)
> End_Date = CDate(Me.txtRptDteTo)
>
> sql = "SELECT TRF_CONTROL_ID, " & _
> "TRF_SUBJ, TRF_DOC_DT, " & _
> "TRF_ORG_OFC_SYM_CD " & _
> "From TR_FOLDER " & _
> "Where TRF_DOC_RCVD_DT " & _
> "between to_date('" & Start_Date & "', 'mm/dd/yyyy') and to_date
> ('" & End_Date & "', 'mm/dd/yyyy')"
>
> thanks.
>
> ---
> Visual C# - A Guide for VB6 Developers
> This book will make it easy to transfer your skills
> from Visual Basic 6 to C#, the language of choice
> of the .NET Framework.
> http://www.wrox.com/ACON11.asp?ISBN=1861007175&p2p0059
>
---
Visual C# - A Guide for VB6 Developers
This book will make it easy to transfer your skills
from Visual Basic 6 to C#, the language of choice
of the .NET Framework.
http://www.wrox.com/ACON11.asp?ISBN=1861007175&p2p0059