General information
Category:
Database DAO/RDO/ODBC/ADO
>Hi all,
>
>I'm unable to write blank data back to the database. When the user edits the data field, if they delete the existing data in a date or numeric field, when I try to write the update back to the database it fails.
>
>Error message is "data type mismatch".
>
>The update works if I put bogus data in the SQL, but not if I set (for example) [End] = '' when [End] is a date field.
>
>Can anyone help with this? Is there such a thing as a BlankDate or BlankNumber that I should use? How can I blank out the data?
>
>Regards and thank you for any help,
>John
John;
Hope this gives you an idea. I have a VB Script example and do not have my
VB example available. Play around with the concept.
Does your back end accept a null for the date?
If so, look for the length of the textbox and if it is less than 1 send a null.
VB Script
if len(sProblemDate) > 0 then
oRS("ProblemDate") = sProblemDate
else
oRS("ProblemDate") = null
end if
sub txtDateClosed_OnBlur()
if len(trim(frmLineDetail.txtDateClosed.Value))> 0 then
if Not IsDate(frmLineDetail.txtDateClosed.Value) then
alert ("Not a valid date")
frmLineDetail.txtDateClosed.focus()
end if
end if
end sub
Tom
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only