Are you concatenating your SQL insert string using that value? If so, it
won't put the word null in, it'll add nothing as the value of your
variable is null.  So you'll get something like :-
 
INSERT INTO myTable (idaValue) VALUES ();
 
...which will cause an error. You could do something like this :-
 
strSQL = "INSERT INTO myTable (idaValue) VALUES ("
if len(request.form("idaValue")) = 0 then
    strSQL = strSQL & "null"
else
    strSQL = strSQL & request.form("idaValue")
end if
strSQL = strSQL & ")"
 
Dan

________________________________

From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of
Grinwald, Uri
Sent: 07 July 2005 14:46
To: [email protected]
Subject: RE: [AspClassicAnyQuestionIsOk] Leaving field blank in access
database


Hi.

I was wondering if someone could please assist me.
I am collecting values from a form to insert into an Access DB.

Two of my form fields are of the data type numbers and when the user
leaves these fields blank I get a syntax error in my insert statement.
In my DB those fields arew not required.

I tried the following code but I still have no luck.

idaValue = Request.Form("idaValue")
if idaValue = "" then
idaValue = null
end if

As a test I trield hard codinf any value which does work.

idaValue = Request.Form("idaValue")
if idaValue = "" then
idaValue = 0
end if 

Any ideas how I can keep the field blank and return no errors?

Thanks
Uri


________________________________

YAHOO! GROUPS LINKS 


        
*        Visit your group "AspClassicAnyQuestionIsOk
<http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk> " on the web.
          
*        To unsubscribe from this group, send an email to:
         [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]
subscribe> 
          
*        Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service <http://docs.yahoo.com/info/terms/> . 


________________________________




[Non-text portions of this message have been removed]



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to