igloo iguana
Member
I have a database that has a date field with the date format.
I have a form that has the DateTimePicker so the user can select a date to see all the files on that particular date.
I could not get anything to work so I made a hidden label that recieves the custom date from the datetimepicker and then passes that value into my sql statement for my crystal report.
Anybody have a better way of doing this.
MY CODE.........................................................................................
Private Sub frmReports_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
loads the date from the datetimepicker into the label at form load time
lblHidden.Text = DateTimePicker.Text
End Sub
My custom datetimepicker date format
Private Sub DateTimePicker_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker.ValueChanged
custom format the datetimepicker
DateTimePicker.Format = DateTimePickerFormat.Custom
Display the date as "05/02/2003".
DateTimePicker.CustomFormat = "MM/dd/yyyy"
loads the date from the datetimepicker into the label whenever a new date is selected
lblHidden.Text = DateTimePicker.Text
End Sub
this is in my Crystal reports statement
selectFormula = "{Ticket.Flight_date} = #" & lblHidden.Text & "# "
these are things that I tried and they work
this pulls all tickets
selectFormula = "{select * from Ticket.Ticket_ID}"
this works with a literal date hard coded into it
selectFormula = "{Ticket.Flight_date} = # 5/2/2003 # "
Ask me a question if you need clarification
Thanks
I have a form that has the DateTimePicker so the user can select a date to see all the files on that particular date.
I could not get anything to work so I made a hidden label that recieves the custom date from the datetimepicker and then passes that value into my sql statement for my crystal report.
Anybody have a better way of doing this.
MY CODE.........................................................................................
Private Sub frmReports_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
loads the date from the datetimepicker into the label at form load time
lblHidden.Text = DateTimePicker.Text
End Sub
My custom datetimepicker date format
Private Sub DateTimePicker_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker.ValueChanged
custom format the datetimepicker
DateTimePicker.Format = DateTimePickerFormat.Custom
Display the date as "05/02/2003".
DateTimePicker.CustomFormat = "MM/dd/yyyy"
loads the date from the datetimepicker into the label whenever a new date is selected
lblHidden.Text = DateTimePicker.Text
End Sub
this is in my Crystal reports statement
selectFormula = "{Ticket.Flight_date} = #" & lblHidden.Text & "# "
these are things that I tried and they work
this pulls all tickets
selectFormula = "{select * from Ticket.Ticket_ID}"
this works with a literal date hard coded into it
selectFormula = "{Ticket.Flight_date} = # 5/2/2003 # "
Ask me a question if you need clarification
Thanks