PC Review


Reply
Thread Tools Rate Thread

Date Format/Problem In Query

 
 
=?Utf-8?B?SmVmZiBD?=
Guest
Posts: n/a
 
      31st Jan 2005
The following is the query I am working with:

SELECT Child.ChildTable_ID, Child.ParentTable_ID, Child.Administered,
Child.AdminBy, Child.ReadOn, Child.ReadBy, Child.Induration,
Child.NegativePPD, Child.PositivePPD,
DMax("[ReadOn]","Child","[ParentTable_ID] =" & [ID]) AS [Current TB Test
Date], [All Employees].ID, [All Employees].Last, [All Employees].First, [All
Employees].MI, [All Employees].Dept, [All Employees].Questionaire, [All
Employees].[Annual Test], [All Employees].[Bi-Annual Test], [All
Employees].Active, [All Employees].Termed, [All Employees].Suspended, [All
Employees].[Contract Employee], [All Employees].[Agency Employee], [All
Employees].[Agency Name], [All Employees].[Date Of Hire], [All
Employees].[Drug Screen], [All Employees].[Positive PPD], [All
Employees].[Negative PPD]
FROM [All Employees] INNER JOIN Child ON [All Employees].ID =
Child.ParentTable_ID
ORDER BY Child.ReadOn DESC;

This query is the basis for a subform and the “DMax” expression for
[Current TB Test Date] nicely isolates the most current inoculation for each
employee record.

I need to be able to use this [Current TB Test Date] field in other queries
for reports where I use expressions in the “Criteria:” . I cannot come up
with an expression to give me:
All dates older than 6 months ago this month OR All dates older than 12
months ago this month.
I believe it has to do with date format problems which I really do not
understand nor have I any idea how to solve. I have tried using:
[Current TB Test Date]: CDate (DMax("[ReadOn]","Child","[ParentTable_ID] ="
& [ID])) in my criteria for the query above but this gives me errors. I seem
to be going in circles. I tried using just one report and feeding different
date expressions through an unbound form but that produced errors also. Any
help or ideas appreciated. Thank You.


 
Reply With Quote
 
 
 
 
[MVP] S.Clark
Guest
Posts: n/a
 
      31st Jan 2005
http://www.mvps.org/access/queries/qry0020.htm

--
Steve Clark, Access MVP
FMS, Inc.
www.fmsinc.com/consulting

"Jeff C" <(E-Mail Removed)> wrote in message
news:1F2AFF16-1C14-49D5-B33D-(E-Mail Removed)...
> The following is the query I am working with:
>
> SELECT Child.ChildTable_ID, Child.ParentTable_ID, Child.Administered,
> Child.AdminBy, Child.ReadOn, Child.ReadBy, Child.Induration,
> Child.NegativePPD, Child.PositivePPD,
> DMax("[ReadOn]","Child","[ParentTable_ID] =" & [ID]) AS [Current TB Test
> Date], [All Employees].ID, [All Employees].Last, [All Employees].First,
> [All
> Employees].MI, [All Employees].Dept, [All Employees].Questionaire, [All
> Employees].[Annual Test], [All Employees].[Bi-Annual Test], [All
> Employees].Active, [All Employees].Termed, [All Employees].Suspended, [All
> Employees].[Contract Employee], [All Employees].[Agency Employee], [All
> Employees].[Agency Name], [All Employees].[Date Of Hire], [All
> Employees].[Drug Screen], [All Employees].[Positive PPD], [All
> Employees].[Negative PPD]
> FROM [All Employees] INNER JOIN Child ON [All Employees].ID =
> Child.ParentTable_ID
> ORDER BY Child.ReadOn DESC;
>
> This query is the basis for a subform and the "DMax" expression for
> [Current TB Test Date] nicely isolates the most current inoculation for
> each
> employee record.
>
> I need to be able to use this [Current TB Test Date] field in other
> queries
> for reports where I use expressions in the "Criteria:" . I cannot come up
> with an expression to give me:
> All dates older than 6 months ago this month OR All dates older than 12
> months ago this month.
> I believe it has to do with date format problems which I really do not
> understand nor have I any idea how to solve. I have tried using:
> [Current TB Test Date]: CDate (DMax("[ReadOn]","Child","[ParentTable_ID]
> ="
> & [ID])) in my criteria for the query above but this gives me errors. I
> seem
> to be going in circles. I tried using just one report and feeding
> different
> date expressions through an unbound form but that produced errors also.
> Any
> help or ideas appreciated. Thank You.
>
>



 
Reply With Quote
 
 
 
 
=?Utf-8?B?SmVmZiBD?=
Guest
Posts: n/a
 
      31st Jan 2005
I always get into uncharted waters, interesting.....following the article I
ended up with the following query:

SELECT [All Employees].Last, [All Employees].First, [All Employees].Dept,
[3_1Test].MaxOfReadOn, [All Employees].Active, [All Employees].[Bi-Annual
Test], [All Employees].[Annual Test]
FROM (3_1Test INNER JOIN [All Employees] ON [3_1Test].ID = [All
Employees].ID) INNER JOIN Child ON (Child.ReadOn = [3_1Test].MaxOfReadOn) AND
([All Employees].ID = Child.ParentTable_ID)
WHERE ((([3_1Test].MaxOfReadOn) Between
DateSerial(Year(Date()),Month(Date())-5,1) And
DateSerial(Year(Date()),Month(Date())-4,0) Or
([3_1Test].MaxOfReadOn)=Month(Date())+"1" & Year(Date())-"1") AND (([All
Employees].Active)=Yes) AND (([All Employees].[Bi-Annual Test])=Yes)) OR
((([All Employees].Active)=Yes) AND (([All Employees].[Annual Test])=Yes));

When I try and run the query I get data type mismatch. What am I not
understanding?

"[MVP] S.Clark" wrote:

> http://www.mvps.org/access/queries/qry0020.htm
>
> --
> Steve Clark, Access MVP
> FMS, Inc.
> www.fmsinc.com/consulting
>
> "Jeff C" <(E-Mail Removed)> wrote in message
> news:1F2AFF16-1C14-49D5-B33D-(E-Mail Removed)...
> > The following is the query I am working with:
> >
> > SELECT Child.ChildTable_ID, Child.ParentTable_ID, Child.Administered,
> > Child.AdminBy, Child.ReadOn, Child.ReadBy, Child.Induration,
> > Child.NegativePPD, Child.PositivePPD,
> > DMax("[ReadOn]","Child","[ParentTable_ID] =" & [ID]) AS [Current TB Test
> > Date], [All Employees].ID, [All Employees].Last, [All Employees].First,
> > [All
> > Employees].MI, [All Employees].Dept, [All Employees].Questionaire, [All
> > Employees].[Annual Test], [All Employees].[Bi-Annual Test], [All
> > Employees].Active, [All Employees].Termed, [All Employees].Suspended, [All
> > Employees].[Contract Employee], [All Employees].[Agency Employee], [All
> > Employees].[Agency Name], [All Employees].[Date Of Hire], [All
> > Employees].[Drug Screen], [All Employees].[Positive PPD], [All
> > Employees].[Negative PPD]
> > FROM [All Employees] INNER JOIN Child ON [All Employees].ID =
> > Child.ParentTable_ID
> > ORDER BY Child.ReadOn DESC;
> >
> > This query is the basis for a subform and the "DMax" expression for
> > [Current TB Test Date] nicely isolates the most current inoculation for
> > each
> > employee record.
> >
> > I need to be able to use this [Current TB Test Date] field in other
> > queries
> > for reports where I use expressions in the "Criteria:" . I cannot come up
> > with an expression to give me:
> > All dates older than 6 months ago this month OR All dates older than 12
> > months ago this month.
> > I believe it has to do with date format problems which I really do not
> > understand nor have I any idea how to solve. I have tried using:
> > [Current TB Test Date]: CDate (DMax("[ReadOn]","Child","[ParentTable_ID]
> > ="
> > & [ID])) in my criteria for the query above but this gives me errors. I
> > seem
> > to be going in circles. I tried using just one report and feeding
> > different
> > date expressions through an unbound form but that produced errors also.
> > Any
> > help or ideas appreciated. Thank You.
> >
> >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Link date to a table with Date Range (Eff Date and term date) =?Utf-8?B?S2V2aW4gUmVlZA==?= Microsoft Access 1 31st Aug 2006 04:23 PM
in a query test on date to see if it falls between two date date? =?Utf-8?B?ZGF0ZSBjYWxjIGluIHF1ZXJ5IGluIGFjY2VzcyAy Microsoft Access Queries 1 1st Jun 2006 04:34 AM
i have two date fileds Opend date Due date, can i set default on due date so, its always = to open date on my data entry form1 Urgent Mike Saifie Microsoft Access Form Coding 1 9th Mar 2006 02:08 AM
Run Query from date to date, Print the from date to date in the header of the report? Dustin Swartz Microsoft Access Queries 1 25th Jan 2005 08:06 PM
Query week to date, month to date, year to date hours =?Utf-8?B?VHk=?= Microsoft Access Queries 1 15th Dec 2004 04:46 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:05 AM.