insert emtpy numeric field

qaccess

Registered User.
Local time
Today, 08:25
Joined
Aug 7, 2004
Messages
29
I have a numeric field with No value. I create a insert record statement with asp. The problem is when I leave the numeric field emtpy I get an error.

How can i insert a Null value or emtpy string for numeric values
 
You can't put an empty string into a numeric field. Don't confuse a zero-length string "" with Null.
 
Empty numeric fields

How can i then leave the fields empty.By an insert statement without getting an error
 
Either omit the column entirely or use the word Null - no quotes - to indicate an "empty" value.

INSERT INTO Table2 ( numDC, numD, paydt )
SELECT Table1.numDC, Null, Table1.paydt
FROM Table1;
 
ThanXs but still a problem

I know that it works with Null. But now this. I create a database with soccer results. I have lets say 2 matches. I get the textfield information from another table and put this in another table with also two numeric fields

home[textfield] - away[textfield] for[numericfield] - against[numericfield]
team1 - team2
team3 - team4

Lets say I know one result. I Fill in for example.

team1 - team2 1 - 0
team3 - team4 [i don't know and leave these numeric fields emtpy]

When I insert I get an error because I leave the fields empty. I have to otherwise don't get an correct ranking. because 0 - 0 gives 1 point

How can i leave the numeric fields emtpy by insert statement
 
This works

I did use some If statements and that works. They ignore the empty fields

Dim varCount
varCount = 5


If Request("MM_insert") <> "" Then
for i= 0 to varCount
uitslagen.addnew
uitslagen("home")=Request("home" & i)
uitslagen("away")=Request("away" & i)
If Request("for" & i) <> "" Then
uitslagen("for")= Request("for" & i)
End If

If Request("against" & i) <> "" Then
uitslagen("against")= Request("against" & i)
End If

uitslagen.update
Next
End if
 

Users who are viewing this thread

Back
Top Bottom