insert emtpy numeric field (1 Viewer)

qaccess

Registered User.
Local time
Yesterday, 21:36
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
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 00:36
Joined
Feb 19, 2002
Messages
43,478
You can't put an empty string into a numeric field. Don't confuse a zero-length string "" with Null.
 

qaccess

Registered User.
Local time
Yesterday, 21:36
Joined
Aug 7, 2004
Messages
29
Empty numeric fields

How can i then leave the fields empty.By an insert statement without getting an error
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 00:36
Joined
Feb 19, 2002
Messages
43,478
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;
 

qaccess

Registered User.
Local time
Yesterday, 21:36
Joined
Aug 7, 2004
Messages
29
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
 

qaccess

Registered User.
Local time
Yesterday, 21:36
Joined
Aug 7, 2004
Messages
29
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

Top Bottom