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

I can't think of this in any other terms other than  "YUCK"

What is your goal here, anything after 01/01/2000 or anything like
what?

I personally always save and use dates as long integers, except for
display of course.  Your selections become so precise.  You may
get a way with this or you may not, my guess is eventually your going
to have problems with it.

Quote:

>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.



Wed, 18 Jun 1902 08:00:00 GMT  
 Finding a date field using LIKE and ADO
use an SQL statement and put your LIKE operator in the WHERE clause

ado.Recordset = "select fields from table where date like '01/01/2*'"

something like that...

Mr. X


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



Wed, 18 Jun 1902 08:00:00 GMT  
 Finding a date field using LIKE and ADO
You could do somthing like;

SQL = "Select * From MyTable Where Format(DateField,'MM/DD/YYYY') Like
'01/01/2*"

This, of course, depends on the database engine you are using (It will work
with Jet).  I wouldn't do this on a very large table.....

-Kim


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



Wed, 18 Jun 1902 08:00:00 GMT  
 Finding a date field using LIKE and ADO
I cant think of the code off hand, but isnt there a feature of SQL
that you could use to format the date field the way you want and then
do a like on that?

WHERE TO_STRING(DateOfBirth) LIKE "01/01/2*"

On Wed, 12 Apr 2000 15:51:57 +1000, "Young Lim"

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



Wed, 18 Jun 1902 08:00:00 GMT  
 Finding a date field using LIKE and ADO
Try enclosing your date with # characters as in:

    select * from table where datecol = #04/11/2000#

Eric

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



Wed, 18 Jun 1902 08:00:00 GMT  
 Finding 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



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Finding date field using LIKE operator using ADO

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

3. Find 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