csababenyi
New Member
- Joined
- Nov 17, 2020
- Messages
- 15
- Office Version
- 365
- 2019
- 2016
- Platform
- Windows
- Web
Hi All.
I am trying to create a simple date search function but Access always complaining about the DoCmd.ApplyFilter task.
See below. Any insight would be greatly appriciated.
Search button Syntax Error (Missing Operator):
Clear button Sytnax Error (Missing Operator):
Got stuck, must be something simple I am overlooking. Thank you.
I am trying to create a simple date search function but Access always complaining about the DoCmd.ApplyFilter task.
See below. Any insight would be greatly appriciated.
VBA Code:
Option Compare Database
Private Sub Command22_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 "Kérem adjon meg dátum sort", vbInformation, "Dátum sor Szükséges"
Me.OrderDateFrom.SetFocus
Else
strCriteria = "([DATUM] >= #" & Me.OrderDateFrom & "& And [DATUM] <= #" & Me.OrderDateTo & "#)"
task = "select * from tEFI2021 where (" & strCriteria & ") order by [DATUM]"
DoCmd.ApplyFilter task
End If
End Sub
Private Sub Command23_Click()
Dim task As String
Me.OrderDateFrom = Null
Me.OrderDateTo = ""
task = "select * from tEFI2021 where (" & strCriteria & ") order by [DATUM]"
DoCmd.ApplyFilter task
End Sub
Search button Syntax Error (Missing Operator):
Clear button Sytnax Error (Missing Operator):
Got stuck, must be something simple I am overlooking. Thank you.