gojets1721
Registered User.
- Local time
- Yesterday, 18:58
- Joined
- Jun 11, 2019
- Messages
- 430
I have a search command button that I'm hoping will allow the user to input a name and it filters all the entries down to that name. I also want it to automatically filter to only the last 18 months.
I came up with this rudimentary code and it doesn't work. I'm very green to VBA. Any suggestions?
I came up with this rudimentary code and it doesn't work. I'm very green to VBA. Any suggestions?
Code:
Private Sub cmdSearch_Load()
Dim S As String
S = InputBox("Enter Customer Name", "Customer Name Search")
If S = "" Then Exit Sub
Me.Filter = "CustomerName LIKE ""*" & S & "*""" And ComplaintDate = DateAdd("m", -18, Date)
Me.FilterOn = True
End Sub