nickfatool
IS-IT--Management
CR8.5Dev, VB6, Access97
OK, firstly I've got to apologise for my "Access" mentality and methodologies.
I'm trying to recreate a little native Access functionality using VB and Crystal.
In Access you can have a form with a command button open a report that includes subreports.
The report & subreports can retrieve a value from a textbox on the form that called it and perform calculations.
The report/subreports reference the control on the form via
"Forms![MyForm]![MyTextBox]"
What I'd like to end up with is a form with a single text box and command button, the user will supply a date in the text box and press the command button. The main Crystal report (with 3 subs) opens, the 3 sub reports reference the user's date and return records that match that date.
For now I've written a "UDL" dll that includes a Public variable "GlobalDate" and a function "fDate" and I've referenced "fDate" from within Crystal's record selection formula.
This is kind of groovy, as it only asks for the date value once and all subreports can reference it. But I really would like to have users enter the required date on the form they use to open the report.
Any clues would be greatly appreciated.
TIA,
Rob Dexter.
OK, firstly I've got to apologise for my "Access" mentality and methodologies.
I'm trying to recreate a little native Access functionality using VB and Crystal.
In Access you can have a form with a command button open a report that includes subreports.
The report & subreports can retrieve a value from a textbox on the form that called it and perform calculations.
The report/subreports reference the control on the form via
"Forms![MyForm]![MyTextBox]"
What I'd like to end up with is a form with a single text box and command button, the user will supply a date in the text box and press the command button. The main Crystal report (with 3 subs) opens, the 3 sub reports reference the user's date and return records that match that date.
For now I've written a "UDL" dll that includes a Public variable "GlobalDate" and a function "fDate" and I've referenced "fDate" from within Crystal's record selection formula.
Code:
Option Explicit
Public GlobalDate As Date
Private Sub Class_Initialize()
GlobalDateFrom = 0
End Sub
Public Function fDate() As Date
Dim sInputDate As String
'Has GlobalDate been initialised?
If GlobalDate = 0 Then
sInputDate = InputBox("Enter the date to work back from.", "Enter
Date", Format(Date, "dd/mm/yyyy"))
GlobalDate = CDate(sInputDate)
Else
GlobalDate = GlobalDate
End If
fDate = GlobalDate
End Function
This is kind of groovy, as it only asks for the date value once and all subreports can reference it. But I really would like to have users enter the required date on the form they use to open the report.
Any clues would be greatly appreciated.
TIA,
Rob Dexter.