View Single Post
Old 05-13-2016, 09:30 PM
SwsCheez SwsCheez is offline
Join Date: Oct 2012
Posts: 13
Question DateTimePicker Date Range in DataGridView

I am a frustrated Newb. I am trying to use a couple of datetimepickers to display the date range from an Access Database in a DataGridView. Here is the code I am using:

Dim dtp1 As String = DateTimePicker1.Text
Dim dtp2 As String = DateTimePicker2.Text
Dim strCriteria, task As String

If dtp1 = "" Then
MsgBox("Please Enter The Date Range", vbInformation, "Date Range Required")
strCriteria = "([Appt Date] >= #" & dtp1 & "# And [Appt Date] <= #" & dtp2 & "#)"
task = "SELECT * FROM BDC1 WHERE (" & strCriteria & ") order by [Appt Date]"

End If
I'll procrastinate tomorrow
Reply With Quote