Hi,
Im using a form with two input boxes 'OrderDateFrom' & 'OrderDateTo' then I press search button with this code below, can anyone see any issues with it as it doesn't work ???
Cheers
______________________________________________________________
Option Compare Database
Private Sub Command12_Click()
' search button
Call search
End Sub
Sub search()
Dim strcriteria, task As String
Me.Refresh
If IsNull(Me.OrderDateFrom) Or IsNull(Me.OrderDateTo) Then
MsgBox "please enter the date range", vbInformation, "Date Range Required"
Me.OrderDateFrom.SetFocus
Else
strcriteria = "([Order Date] >= #" & Me.OrderDateFrom & "# and [Order Date] <= #" & Me.OrderDateTo & "#)"
task = "Select * from Table1 where (" & strcriteria & ") order by [Order Date)"
DoCmd.ApplyFilter task
End If
End Sub
Cheers
Im using a form with two input boxes 'OrderDateFrom' & 'OrderDateTo' then I press search button with this code below, can anyone see any issues with it as it doesn't work ???
Cheers
______________________________________________________________
Option Compare Database
Private Sub Command12_Click()
' search button
Call search
End Sub
Sub search()
Dim strcriteria, task As String
Me.Refresh
If IsNull(Me.OrderDateFrom) Or IsNull(Me.OrderDateTo) Then
MsgBox "please enter the date range", vbInformation, "Date Range Required"
Me.OrderDateFrom.SetFocus
Else
strcriteria = "([Order Date] >= #" & Me.OrderDateFrom & "# and [Order Date] <= #" & Me.OrderDateTo & "#)"
task = "Select * from Table1 where (" & strcriteria & ") order by [Order Date)"
DoCmd.ApplyFilter task
End If
End Sub
Cheers