By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,041 Members | 1,858 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,041 IT Pros & Developers. It's quick & easy.

Date Search Problem

P: n/a
DD
The user needs to search by a date they enter into the searchField my
code is NOT working can anyone advise where i am going wrong please
Regards
DD

Private Sub cmdFind_Click()
Dim strTable As String
Dim strField As String
Dim strCriteria As String

strCriteria = "*" & txtCriteria & "*"
On Error GoTo FindErr

Select Case OptSearch
Case 1
Me![frmSiteFilter].Form.Filter = "[ShipNumber] Like '*" &
txtCriteria & "*'"
Case 2
Me![frmSiteFilter].Form.Filter = "[ShipDate]='#" &
txtCriteria & "#'"

End Select
Me![frmSiteFilter].Form.FilterOn = True
Exit Sub
FindErr:
Beep
Me![frmSiteFilter].Form.Filter = ""
Me![frmSiteFilter].Form.FilterOn = False
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
you need to lose the single quotes, ie.
Me![frmSiteFilter].Form.Filter = "[ShipDate]=#" &
txtCriteria & "#"

da**********@bigpond.com.au (DD) wrote in message news:<14**************************@posting.google. com>...
The user needs to search by a date they enter into the searchField my
code is NOT working can anyone advise where i am going wrong please
Regards
DD

Private Sub cmdFind_Click()
Dim strTable As String
Dim strField As String
Dim strCriteria As String

strCriteria = "*" & txtCriteria & "*"
On Error GoTo FindErr

Select Case OptSearch
Case 1
Me![frmSiteFilter].Form.Filter = "[ShipNumber] Like '*" &
txtCriteria & "*'"
Case 2
Me![frmSiteFilter].Form.Filter = "[ShipDate]='#" &
txtCriteria & "#'"

End Select
Me![frmSiteFilter].Form.FilterOn = True
Exit Sub
FindErr:
Beep
Me![frmSiteFilter].Form.Filter = ""
Me![frmSiteFilter].Form.FilterOn = False

Nov 12 '05 #2

P: n/a
Ixnay on the asterisk for dates. IOW, an * is OK for text, not for
dates.

DD wrote:
The user needs to search by a date they enter into the searchField my
code is NOT working can anyone advise where i am going wrong please
Regards
DD

Private Sub cmdFind_Click()
Dim strTable As String
Dim strField As String
Dim strCriteria As String

strCriteria = "*" & txtCriteria & "*"
On Error GoTo FindErr

Select Case OptSearch
Case 1
Me![frmSiteFilter].Form.Filter = "[ShipNumber] Like '*" &
txtCriteria & "*'"
Case 2
Me![frmSiteFilter].Form.Filter = "[ShipDate]='#" &
txtCriteria & "#'"

End Select
Me![frmSiteFilter].Form.FilterOn = True
Exit Sub
FindErr:
Beep
Me![frmSiteFilter].Form.Filter = ""
Me![frmSiteFilter].Form.FilterOn = False


Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.