Find a date field using LIKE and ADO 
Author Message
 Find a date field using LIKE and ADO

Can anyone please tell me how to find a record using a date field with the
LIKE operator using ADO?

For example, if I entered 01/01/2, I would like to use the LIKE operator to
search for the 01/01/2000 record.

With DAO, I can use the LIKE operator and treat the date field as a text and
it works correctly. For example, Find DateOfBirth LIKE "01/01/2*" will find
the first record where the DateOfBirth field starts with 01/01/2.

Any help would be greatly appreciated.
Young



Sun, 29 Sep 2002 03:00:00 GMT  
 Find a date field using LIKE and ADO

Searches a Recordset for the record that satisfies the specified criteria. If the criteria is met, the recordset position is set on the found record; otherwise, the position is set on the end of the recordset.

Syntax

Find (criteria, SkipRows, searchDirection, start)

Parameters

criteria   A String containing a statement that specifies the column name, comparison operator, and value to use in the search.

SkipRows   An optional Long value, whose default value is zero, that specifies the offset from the current row or start bookmark to begin the search.

searchDirection   An optional SearchDirectionEnum value that specifies whether the search should begin on the current row or the next available row in the direction of the search. Its value can be adSearchForward or adSearchBackward. The search stops at the start or end of the recordset, depending on the value of searchDirection.

start   An optional Variant bookmark to use as the starting position for the search.

Remarks

The comparison operator in criteria may be ">" (greater than), "<" (less than), "=" (equal), ">=" (greater than or equal), "<=" (less than or equal), "<>" (not equal), or "like" (pattern matching).

The value in criteria may be a string, floating point number, or date. String values are delimited with single quotes (for example, "state = 'WA'"). Date values are delimited with "#" (number sign) marks (for example, "start_date > #7/22/97#").

If the comparison operator is "like", the string value may contain "*" (one or more occurrences of any character) or "_" (one occurrence of any character). (For example, "state like M_*" matches Maine and Massachusetts.)

Quote:

> Can anyone please tell me how to find a record using a date field with the
> LIKE operator using ADO?

> For example, if I entered 01/01/2, I would like to use the LIKE operator to
> search for the 01/01/2000 record.

> With DAO, I can use the LIKE operator and treat the date field as a text and
> it works correctly. For example, Find DateOfBirth LIKE "01/01/2*" will find
> the first record where the DateOfBirth field starts with 01/01/2.

> Any help would be greatly appreciated.
> Young



Mon, 30 Sep 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Finding date field using LIKE operator using ADO

2. Problem find a DATE (TIME) field using ADO

3. Finding a date field using LIKE and ADO

4. Problem finding a DATE (TIME) field using ADO and VB6

5. Filtering ADO Recordset on Date Field using NON-US Locale

6. ADO with Access Date/Time field not storing the time, just the date

7. ADO Date Fields (ADO 2.1, VB 6, Oracle 8)

8. ADO Finding Highest Number in ADO Recordset field?

9. Using ADO w/ADO data control date problems

10. Find / Find next routine using ADO

11. Visual Liking in .Net using TREE VIEW control

12. Find the last date in a field previous to today

 

 
Powered by phpBB® Forum Software