# Miscellaneous > SQL Scripts >  stuck

## ZaWolfen

Confused newbie that I am. I could use a little advice.
I get this error if I try to inset an empty string into a DateTime field.
Data type mismatch in criteria expression. 
Is there any way to include an if statement or something that will bypass inseting anything into this DateTime field if I try to pass an empty string to it? 
I'm using SQL and ASP.

----------


## JBane

First make your datetime field nullable.
Then you will need some logic in your asp page:

<%

cmdText = " Select * from sometable "
Set rs = CreateObject("ADODB.Recordset")
With rs
 .ActiveConnection = cn
     .CursorType = 2 
    .LockType = 3 
 .Open cmdText
End With

' If statement to handle blank form value
if request("SomeDateColumn") <> "" then
rs("SomeDateColumn") = request("SomeDateColumn")
else
rs("SomeDateColumn") = null
end if 


rs.Update

%>



Jeff

----------

