Isdate?

  • Thread starter Thread starter Golfinray
  • Start date Start date
G

Golfinray

I was trying to use isdate in a query. I have a field that contains dates,
numbers, text, symbols. I'm trying to extract just the records that are
dates. I couldn't get isdate to work in an IIF statement. Is there a better
way? I also tried Between but it just wouldn't pull ALL of the dates. Thanks
for your help.
 
Karl. that gave me -1's, not the actual dates. Thanks!

KARL DEWEY said:
Try this --
Expr1: IsDate(DateValue([YourField]))
--
KARL DEWEY
Build a little - Test a little


Golfinray said:
I was trying to use isdate in a query. I have a field that contains dates,
numbers, text, symbols. I'm trying to extract just the records that are
dates. I couldn't get isdate to work in an IIF statement. Is there a better
way? I also tried Between but it just wouldn't pull ALL of the dates. Thanks
for your help.
 
IsDate returns a -1 if it test True. You need another field for the actual
date.
--
KARL DEWEY
Build a little - Test a little


Golfinray said:
Karl. that gave me -1's, not the actual dates. Thanks!

KARL DEWEY said:
Try this --
Expr1: IsDate(DateValue([YourField]))
--
KARL DEWEY
Build a little - Test a little


Golfinray said:
I was trying to use isdate in a query. I have a field that contains dates,
numbers, text, symbols. I'm trying to extract just the records that are
dates. I couldn't get isdate to work in an IIF statement. Is there a better
way? I also tried Between but it just wouldn't pull ALL of the dates. Thanks
for your help.
 
I was trying to use isdate in a query. I have a field that contains dates,
numbers, text, symbols. I'm trying to extract just the records that are
dates. I couldn't get isdate to work in an IIF statement. Is there a better
way? I also tried Between but it just wouldn't pull ALL of the dates. Thanks
for your help.

Put a calculated field in your query by typing

ItsADate: IsDate([fieldname])

in a vacant Field cell in your query. Put a criterion of True on this field.
This will limit retrieval to those records where the field contains a text
string which can be interpreted as a date.

Put a second calculated field in the query:

CDate([fieldname])

to get a Date/Time value for those records; this field can then be used for
sorting, criteria, etc.

Naturally records where the field does not contain a date will not be
searchable. You're paying the penalty for letting garbage data into your
database... <g>
 
Or you can use

Field: ShowDates: IIF(IsDate(YourField),CDate(YourField),Null)

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
Thanks so much, guys. This is not my garbage, it's someones' garbage from a
spreadsheet I imported to try to get some of their data. Spreadsheets -
BluuuuuHHHH!

John W. Vinson said:
I was trying to use isdate in a query. I have a field that contains dates,
numbers, text, symbols. I'm trying to extract just the records that are
dates. I couldn't get isdate to work in an IIF statement. Is there a better
way? I also tried Between but it just wouldn't pull ALL of the dates. Thanks
for your help.

Put a calculated field in your query by typing

ItsADate: IsDate([fieldname])

in a vacant Field cell in your query. Put a criterion of True on this field.
This will limit retrieval to those records where the field contains a text
string which can be interpreted as a date.

Put a second calculated field in the query:

CDate([fieldname])

to get a Date/Time value for those records; this field can then be used for
sorting, criteria, etc.

Naturally records where the field does not contain a date will not be
searchable. You're paying the penalty for letting garbage data into your
database... <g>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top