Hello,
How does one handle an insert statement in vba in which some fields (values coming from unbound textboxes) may or may not be blank? Specifically, the problem is with date fields which are not required and may therefore be left blank by the user.
I did an extensive search, but all the articles and threads I found seem to resolve in a manner similar to this thread:
http://www.access-programmers.co.uk/forums/showthread.php?t=114920
where the author claims the problem was resolved by using a statement like:
Datetoinsert = IIf(IsNull(Me.txtDate), vbNull, Me.txtDate)
This does NOT work. Neither does replacing vbNull with Null or ''. I still get an error that fails when it thinks the insert statement is trying to insert ##.
Does anyone know a solution to this that actually works?
Thank you.
How does one handle an insert statement in vba in which some fields (values coming from unbound textboxes) may or may not be blank? Specifically, the problem is with date fields which are not required and may therefore be left blank by the user.
I did an extensive search, but all the articles and threads I found seem to resolve in a manner similar to this thread:
http://www.access-programmers.co.uk/forums/showthread.php?t=114920
where the author claims the problem was resolved by using a statement like:
Datetoinsert = IIf(IsNull(Me.txtDate), vbNull, Me.txtDate)
This does NOT work. Neither does replacing vbNull with Null or ''. I still get an error that fails when it thinks the insert statement is trying to insert ##.
Does anyone know a solution to this that actually works?
Thank you.