clear out a date programmatically

  • Thread starter Thread starter Leif
  • Start date Start date
L

Leif

Try setting NewDate as a Variant. I don't believe Null is
valid for a date data type.
-----Original Message-----
I am trying to clear a date through VBA code in a record in my table.
I keep getting data type mismatch or invalid use of Null error
basically I am :

Dim NewDate as date
NewDate=(Me![ETA])
Forms!currentForm!ETA=NewDate

IsNull(NewDate)

Obviously there is more going on here. But my problem is
that when Me!ETA is blank I get a type mismatch error.
When I check for Null I get a Invalid use of Null error.
Any help you can offer is really appreciated because I
have corrected and overcorrected so many times now I'm
spinning!
 
Thanks for your help Leif, could you supply the proper syntax for setting as a variant? My brain has completely fried on this!
Thanks,Macy

Leif said:
Try setting NewDate as a Variant. I don't believe Null is
valid for a date data type.
-----Original Message-----
I am trying to clear a date through VBA code in a record in my table.
I keep getting data type mismatch or invalid use of Null error
basically I am :

Dim NewDate as date
NewDate=(Me![ETA])
Forms!currentForm!ETA=NewDate

IsNull(NewDate)

Obviously there is more going on here. But my problem is
that when Me!ETA is blank I get a type mismatch error.
When I check for Null I get a Invalid use of Null error.
Any help you can offer is really appreciated because I
have corrected and overcorrected so many times now I'm
spinning!
Thanks, Macy

.
 
Try replacing
Dim NewDate as date

with
Dim NewDate as Variant

The variable should now accept a null value from ETA.
-----Original Message-----
Thanks for your help Leif, could you supply the proper
syntax for setting as a variant? My brain has completely
fried on this!
Thanks,Macy

Leif said:
Try setting NewDate as a Variant. I don't believe Null is
valid for a date data type.
-----Original Message-----
I am trying to clear a date through VBA code in a
record
in my table.
I keep getting data type mismatch or invalid use of
Null
error
basically I am :

Dim NewDate as date
NewDate=(Me![ETA])
Forms!currentForm!ETA=NewDate

IsNull(NewDate)

Obviously there is more going on here. But my problem
is
that when Me!ETA is blank I get a type mismatch error.
When I check for Null I get a Invalid use of Null error.
Any help you can offer is really appreciated because I
have corrected and overcorrected so many times now I'm
spinning!
Thanks, Macy

.
.
 
Thank you so much! Tried it first think this morning and I'm all set!
Sometimes being self taught you miss the simlple things!
Again Thanks, Macy

Try replacing
Dim NewDate as date

with
Dim NewDate as Variant

The variable should now accept a null value from ETA.
-----Original Message-----
Thanks for your help Leif, could you supply the proper
syntax for setting as a variant? My brain has completely
fried on this!
Thanks,Macy

Leif said:
Try setting NewDate as a Variant. I don't believe Null is
valid for a date data type.
-----Original Message-----
I am trying to clear a date through VBA code in a record
in my table.
I keep getting data type mismatch or invalid use of Null
error
basically I am :

Dim NewDate as date
NewDate=(Me![ETA])
Forms!currentForm!ETA=NewDate

IsNull(NewDate)

Obviously there is more going on here. But my problem is
that when Me!ETA is blank I get a type mismatch error.
When I check for Null I get a Invalid use of Null error.
Any help you can offer is really appreciated because I
have corrected and overcorrected so many times now I'm
spinning!
Thanks, Macy

.
.
 
Back
Top