473,379 Members | 1,533 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Search by Date

DD
I have the following code,
The user needs to search by any date they enter into a searchbox, my
code is not working!
Can someone give me a hint or??
Regards

Code
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
1 1419
On 1 Jan 2004 22:01:49 -0800, da**********@bigpond.com.au (DD) wrote:
I have the following code,
The user needs to search by any date they enter into a searchbox, my
code is not working!
Can someone give me a hint or??
Regards

Code
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


You are setting ShipDate as a string. It is surrounded by single
quotes - try removing those.

Me![frmSiteFilter].Form.Filter = "[ShipDate]=#" &
txtCriteria & "#"

Now it is a date literal.

- Jim
Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Greg | last post by:
I have a page that searches a database by a repairman's name and by a date range. It pulls info by the repairman's name but pulls all info in the database regardless of the date. Below is the code...
1
by: ratnakarp | last post by:
Hi, I have a search text box. The user enters the value in the text box and click on enter button. In code behind on button click i'm writing the code to get the values from the database and...
1
by: Eric | last post by:
Hi: I have two files. I search pattern ":" from emails text file and save email contents into a database. Another search pattern " field is blank. Please try again.", vbExclamation + vbOKOnly...
3
by: Chung Leong | last post by:
Here's the rest of the tutorial I started earlier: Aside from text within a document, Indexing Service let you search on meta information stored in the files. For example, MusicArtist and...
0
by: Laszlo Nagy | last post by:
Hi, I'm using imaplib to access an IMAP4 server. I'm reading the IMAP4 specification, and I found something odd. The search command can be used in conjuction with date values. For example, I...
2
by: caine | last post by:
I'm doing a search application for my project. My code can prompt alert popup window when the user doesn't key in any keywords. However, if the user keys in any keywords, it juz return "Please...
9
by: Rick | last post by:
I have a large list of objects where each object has a unique (non-overlapping) date range. The list is sorted chronologically. What is the most efficient way to search this list for a single...
14
by: Simon Gare | last post by:
Hi, have a search.asp page with results.asp page drawing data from an SQL db, problem is the user has to type the whole field value into the search box to retrieve the value on results.asp, what...
1
by: nik707 | last post by:
Hello all, I would like to develop a date search from Form in Access. Here is the sample of previous search coding I have developed used the help of experts on this forum. 'Approach to CSR...
0
by: KevLe | last post by:
I'm building a log search function in c# for a certain management app and would like some help on the design how to solve this, here is my solution (on paper) so far: The log files are saved to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.