Carey
|
| Posted: 04/04/2002, 8:44 AM |
|
I'm having a brain block and would appreciate help.
I've got a date field (MS Access 2000) and upon a certain condition, empty the date field of its contents.
I've tried every conceivable way but still get errors.
Anyone??
Thanks!
|
|
|
 |
Nicole
|
| Posted: 04/05/2002, 12:16 AM |
|
Carey,
you need custom code that checks the condition and set date field value to null (or any be any default date). The task is clear but the information is not enough. When (what actions) and where (what form) do you want to clear date?
|
|
|
 |
Carey
|
| Posted: 04/05/2002, 2:26 AM |
|
Thanks for replying, Nicole.
Right now I've got my code in before update of a record form. If a drop down box, fldstatus_id, isn't set to '10' by the user, then there can be no date in fldship_date or fldfollow_up_date. The page action is a grid form, so it's important to have those date fields cleared before redirect if the dropdown isn't set to 10. (People act on information they see on the grid form)
I tried null, but figure I've got one little piece of code out of place...
Thanks!
|
|
|
 |
Nicole
|
| Posted: 04/05/2002, 3:19 AM |
|
Carey,
Before Update event is right place. Try to compare fldstatus_id value with empty string, e.g.
(ASP)
if fldstatus_id = "" then
fldship_date = ""
fldfollow_up_date = ""
end if
|
|
|
 |
Carey
|
| Posted: 04/05/2002, 6:39 AM |
|
Strange thing, I tried just that...it's giving me a data type mismatch, since my fields (fldship_date and fldfollow_up_date are date fields and I'm trying to put in a blank string.
What's stranger is...I've done just this same thing in another app I created and it works great!
|
|
|
 |
Tom
|
| Posted: 04/05/2002, 6:40 AM |
|
You need to modify the sql before the actual update (I use a replace function and look for any "" and replace that with the word NULL (NO QUOTES)
These do not work
Update mytable set mytime = ""
Update mytable set mytime = 'NULL'
you need to use this
Update mytable set mytime = NULL
No quotes around it.
|
|
|
 |