Punchinello
Programmer
I've read bunches of threads that address NULL and EMPTY issues but none that demonstrates how to assign a NULL or EMPTY value to a numeric or date field. For example, I'm using standard edit controls and assigning their .text properties from an Access table in code like so:
But then a user will do this:
1. Enter a date and save the record to the database.
2. Return to the record, blank out the date and save it.
So I want a statement like one of these (neither of which actually work):
or
And a similar solution for assigning to number fields. Any ideas?
Code:
Ctrl.Text = IIf(IsNull(rs!ADate), "", Format$(rs!ADate, "MM/DD/YYYY"))
1. Enter a date and save the record to the database.
2. Return to the record, blank out the date and save it.
So I want a statement like one of these (neither of which actually work):
Code:
rs!ADate = IIf(Ctrl.Text = vbNullString, Null, CDate(Ctrl.Text))
Code:
rs!ADate = IIf(Ctrl.Text = vbNullString, Empty, CDate(Ctrl.Text))