L
Leslie Isaacs
I have a table [Entry] with text fields [PATIENT_ID], [read_code] and
[START_DATE] (plus others).
[START_DATE] is a text field in the format yyyymmdd.
In a module I have created the following:
Function mydate(START_DATE As String)
mydate = Right([START_DATE], 2) & "/" & mid([START_DATE], 5, 2) & "/" &
Left([START_DATE], 4)
End Function
Originally I had
CDate (Right([START_DATE], 2) & "/" & mid([START_DATE], 5, 2) & "/" &
Left([START_DATE], 4))
in the middle line, but for some reason this still resulted in a text field.
By using Cdate(mydate(.....)) in a query, though, I get what I want...
almost!
In the table, [read_code] represents the type of event, and [START_DATE]
represents the date of the event.
I need to extract the time gap, in weeks, between each patient's <notes
received> event (represented by a [read_code] value of "9311." and their
<[notes summarised]> event (represented by a [read_code] value of "9125."
I am only interested in records with a [notes received] value after 1 April
04.
For some [PATIENT_ID]s there will be no record with a [read_code] value of
"9125."
The SQL of my attempted query is below, but I keep getting the message "You
tried to execute a query that doesn't include the specified function
'IIf([read_code]="9311.",CDate(mydate([START_DATE])))' as part of an
aggregate fuunction"
I've tried all sorts and am getting nowhere.
Hope someone can help
Many thanks
Leslie Isaacs
My query:
SELECT ENTRY.PATIENT_ID, DateDiff("w",[notes received],[notes summarised])
AS weeks, IIf([read_code]="9311.",CDate(mydate([START_DATE]))) AS [notes
summarised] INTO [reg sum delay]
FROM ENTRY
WHERE (((ENTRY.READ_CODE)="9125." Or (ENTRY.READ_CODE)="9311.") AND
((IIf([read_code]="9125.",CDate(mydate([START_DATE]))))>#4/1/2004#))
GROUP BY ENTRY.PATIENT_ID;
[START_DATE] (plus others).
[START_DATE] is a text field in the format yyyymmdd.
In a module I have created the following:
Function mydate(START_DATE As String)
mydate = Right([START_DATE], 2) & "/" & mid([START_DATE], 5, 2) & "/" &
Left([START_DATE], 4)
End Function
Originally I had
CDate (Right([START_DATE], 2) & "/" & mid([START_DATE], 5, 2) & "/" &
Left([START_DATE], 4))
in the middle line, but for some reason this still resulted in a text field.
By using Cdate(mydate(.....)) in a query, though, I get what I want...
almost!
In the table, [read_code] represents the type of event, and [START_DATE]
represents the date of the event.
I need to extract the time gap, in weeks, between each patient's <notes
received> event (represented by a [read_code] value of "9311." and their
<[notes summarised]> event (represented by a [read_code] value of "9125."
I am only interested in records with a [notes received] value after 1 April
04.
For some [PATIENT_ID]s there will be no record with a [read_code] value of
"9125."
The SQL of my attempted query is below, but I keep getting the message "You
tried to execute a query that doesn't include the specified function
'IIf([read_code]="9311.",CDate(mydate([START_DATE])))' as part of an
aggregate fuunction"
I've tried all sorts and am getting nowhere.
Hope someone can help
Many thanks
Leslie Isaacs
My query:
SELECT ENTRY.PATIENT_ID, DateDiff("w",[notes received],[notes summarised])
AS weeks, IIf([read_code]="9311.",CDate(mydate([START_DATE]))) AS [notes
summarised] INTO [reg sum delay]
FROM ENTRY
WHERE (((ENTRY.READ_CODE)="9125." Or (ENTRY.READ_CODE)="9311.") AND
((IIf([read_code]="9125.",CDate(mydate([START_DATE]))))>#4/1/2004#))
GROUP BY ENTRY.PATIENT_ID;