|
-
Nov 15th, 2002, 07:49 AM
#1
Thread Starter
Junior Member
Date-selection with Crystal Reports in VB
I have a date in my database. I select a date on my form in VB and then I have to compare this date with the data on the crystal report.
sSelection = "{Planning.Medewerkernr} = " & CmboMedewerker.BoundText & " {Planning.datum} > " & Format(DPBegin, "dd-mm-yyyy")
WeekReport2.SelectionFormula = sSelection
WeekReport2.PrintReport
It just does nothing. But when I put it like this it worked:
sSelection = "{Planning.Medewerkernr} = " & CmboMedewerker.BoundText
WeekReport2.SelectionFormula = sSelection
WeekReport2.PrintReport
The report was shown and the selection worked. How do I work with the date as a selection with crystal reports and VB?
-
Nov 15th, 2002, 01:02 PM
#2
Hyperactive Member
chk if this wrks..
sSelection = "{Planning.Medewerkernr} = " & CmboMedewerker.BoundText & " and {Planning.datum} > " & Format(DPBegin, "dd-mm-yyyy")
-
Nov 17th, 2002, 08:12 AM
#3
Addicted Member
Hope this is what u want
Hope this is what you were looking for!!! Let me know.
private sub command1_click()
Dim dat1, dat2 As Date
dat1 = CDate(DTP1.Value)
dat2 = CDate(DTP2.Value)
If dat1 > dat2 Then
msg = "Date in first text box should be" & vbCr
msg = msg & "less than second text box"
MsgBox msg, vbInformation
Exit Sub
End If
craccreport.ReportFileName = App.Path & "\accountreport.rpt"
yy1 = Year(DTP1.Value)
mm1 = Month(DTP1.Value)
dd1 = Day(DTP1.Value)
yy2 = Year(DTP2.Value)
MM2 = Month(DTP2.Value)
dd2 = Day(DTP2.Value)
p = "{Account.date} >= date(" & yy1 & "," & mm1 & "," & dd1 & ")and {Account.date} <= date(" & yy2 & "," & MM2 & "," & dd2 & ")"
craccreport.SelectionFormula = p
craccreport.Action = 1
end sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|