craigachan
Registered User.
- Local time
- Yesterday, 17:57
- Joined
- Nov 9, 2007
- Messages
- 282
I have a table called [calendar] with text field [month], [day], and [year]. Other fields are 'PID', (the patientID) All of these fields are short text. This table is used for an patient appointment schedule. and each record is a patient appointment that is used to populate a schdule calander. With the following sql I get all dates and they are all ordered correctly. When an appointment get's cancelled, instead of deleting the appointment, the date gets changed to 99/99/9999 for [month]/[day]/[year].
Asql = "SELECT * FROM [calendar] " & _
"WHERE id = '" & strPID & "' AND [year] <> '9999' AND " & _
"[month] <> '99' AND [day] <> '99' AND " & _
"ORDER BY [year] DESC, [month] DESC, [day] DESC"
This sql works correctly. And then I want to filter out all dates less then Date() with the following sql
Asql = "SELECT * FROM [calendar] " & _
"WHERE id = '" & strPID & "' AND [year] <> '9999' AND " & _
"[month] <> '99' AND [day] <> '99' AND " & _
"[month]/[day]/[year] >= " & Date & " " & _
"ORDER BY [year] DESC, [month] DESC, [day] DESC"
But when I add the 4th line in the above Asql statement, it doesn't exlude dates earlier than Date(). I've tried to format([month]/[day]/[year], 'mm/dd/yyyy') but his did not help.
I also tried "#[month]/[day]/[year]# >= " & Date & " " then I get a syntax error with runtime 5 - Invalid procedure or argument.
Can anyone comment on what I'm doing wrong. Unfortunately the [month], [day], and [year] fields are strings and cant be changed. Thanks for any help.
Asql = "SELECT * FROM [calendar] " & _
"WHERE id = '" & strPID & "' AND [year] <> '9999' AND " & _
"[month] <> '99' AND [day] <> '99' AND " & _
"ORDER BY [year] DESC, [month] DESC, [day] DESC"
This sql works correctly. And then I want to filter out all dates less then Date() with the following sql
Asql = "SELECT * FROM [calendar] " & _
"WHERE id = '" & strPID & "' AND [year] <> '9999' AND " & _
"[month] <> '99' AND [day] <> '99' AND " & _
"[month]/[day]/[year] >= " & Date & " " & _
"ORDER BY [year] DESC, [month] DESC, [day] DESC"
But when I add the 4th line in the above Asql statement, it doesn't exlude dates earlier than Date(). I've tried to format([month]/[day]/[year], 'mm/dd/yyyy') but his did not help.
I also tried "#[month]/[day]/[year]# >= " & Date & " " then I get a syntax error with runtime 5 - Invalid procedure or argument.
Can anyone comment on what I'm doing wrong. Unfortunately the [month], [day], and [year] fields are strings and cant be changed. Thanks for any help.