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 a value entered on a VB form to CR 1

Status
Not open for further replies.

kab555

Programmer
Jan 18, 2002
46
0
0
US
Is there a way to pass a value (in my case a date) that is entered on a VB form into a Crystal Report? I'm using VB6 and CR8. I don't want to display the record selection formula as it is far to long and un-end-user friendly to view.
 
Dim sDate

If the format of the date in your report is truely a date, you'd format it like: (my date control is a masked edit box)

sDate = "Date(" & Right$(mskDate.Text, 4) & "," &
Left$(mskDate.Text, 2) & "," & Mid$(mskDate.Text, 3, 2) & ")"

If it's a string in your report, you'd format it like:

sDate = Right$(mskDate.Text, 4) & Left$(mskDate.Text, 2) & Mid$(mskDate.Text, 3, 2)

Then pass it like:

ReportName.ParameterFields(0) = "Date;" & sDate & ";TRUE"

Where Date is the parameter name.
 
Thank you for the helpful suggestion.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top