Report is not pulling the correct dates

M

marti

I have a table that I import data from an excel sheet into daily.
Occaisionally, I have a need to run a report based on an interview date off
of this table. The report not only will show the dates I need, but also a
bunch of other dates.
I think that the format of the date in the table is causing the problem. The
date is formatted as a text and reads 12212008 (Dec 21, 2008) or 2022009(Feb
2nd, 2009).
I am a beginner level Access user and could use any suggestions anyone may
have. Please let me know if more infomationis needed and thank in advance.
 
J

Jerry Whittle

You need to convert it to a real date. You could do it something like below
in a query. Change the 3 DateField's to the correct field name.

TheDate: CDate(Left([DateField],2) &"/"& mid([DateField],3,2) &"/"&
mid([DateField],5,4))

Their is a problem with CDate in that it will cause an error if you pass
something to it that can't be evaluated as a date. For example and empty or
null field or something like 13132008 or 02302009. You could run something
like below to see if any of your data is a problem.

ADate: IsDate([DateField])

It will return FALSE for any problem records.
 
M

marti

Jerry, I am a very new user to Access, so I am about to ask what I think is a
basic question:
In order to convert the Interview Date to a real date, I need to creat a new
query like the one below, but I am not really sure how to set that up and
then link that to the report. Do I just create a query and then link it to
the other query? I'm confused.
Thanks in advance for your patience!

Jerry Whittle said:
You need to convert it to a real date. You could do it something like below
in a query. Change the 3 DateField's to the correct field name.

TheDate: CDate(Left([DateField],2) &"/"& mid([DateField],3,2) &"/"&
mid([DateField],5,4))

Their is a problem with CDate in that it will cause an error if you pass
something to it that can't be evaluated as a date. For example and empty or
null field or something like 13132008 or 02302009. You could run something
like below to see if any of your data is a problem.

ADate: IsDate([DateField])

It will return FALSE for any problem records.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


marti said:
I have a table that I import data from an excel sheet into daily.
Occaisionally, I have a need to run a report based on an interview date off
of this table. The report not only will show the dates I need, but also a
bunch of other dates.
I think that the format of the date in the table is causing the problem. The
date is formatted as a text and reads 12212008 (Dec 21, 2008) or 2022009(Feb
2nd, 2009).
I am a beginner level Access user and could use any suggestions anyone may
have. Please let me know if more infomationis needed and thank in advance.
 
J

Jerry Whittle

You should be able to modify the existing query to produce a real date using
the IsDate function. You may have to change the name of the Control Source
for the text box in the report slightly to match what is in the query.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


marti said:
Jerry, I am a very new user to Access, so I am about to ask what I think is a
basic question:
In order to convert the Interview Date to a real date, I need to creat a new
query like the one below, but I am not really sure how to set that up and
then link that to the report. Do I just create a query and then link it to
the other query? I'm confused.
Thanks in advance for your patience!

Jerry Whittle said:
You need to convert it to a real date. You could do it something like below
in a query. Change the 3 DateField's to the correct field name.

TheDate: CDate(Left([DateField],2) &"/"& mid([DateField],3,2) &"/"&
mid([DateField],5,4))

Their is a problem with CDate in that it will cause an error if you pass
something to it that can't be evaluated as a date. For example and empty or
null field or something like 13132008 or 02302009. You could run something
like below to see if any of your data is a problem.

ADate: IsDate([DateField])

It will return FALSE for any problem records.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


marti said:
I have a table that I import data from an excel sheet into daily.
Occaisionally, I have a need to run a report based on an interview date off
of this table. The report not only will show the dates I need, but also a
bunch of other dates.
I think that the format of the date in the table is causing the problem. The
date is formatted as a text and reads 12212008 (Dec 21, 2008) or 2022009(Feb
2nd, 2009).
I am a beginner level Access user and could use any suggestions anyone may
have. Please let me know if more infomationis needed and thank in advance.
 

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

Similar Threads


Top