Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error adding record to DB if a field is empty

Status
Not open for further replies.

jimmywages

Programmer
Dec 12, 2002
11
0
0
US
Hello,

I am trying to add a record to a database by using the following code:

oRS.Open "select * from myTable", oConn, 1, 3
oRS.AddNew
oRS("TextBody") = ""
oRS.Update

(I cut out some lines that are irrelevant to the problem at hand) So what happens is that it gives me this error:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver]Error in row
/cline/add_done.asp, line 34

Line 34 is where the oRS.Update line is. However, when I tried changing TextBody so that it gets " " (a space) instead of "" (empty string), it works!

So for some reason, it doesn't like the empty string. I checked my Access Database and it clearly says REQUIRED: NO! So if it's not a required field, why can't it accept an empty string?

Any ideas? Thanks in advance for any help.

~jimmy.



 
the "" is probably being equated to null which is a setting you must initiate in access to be allowed. " " is a value in all respect to the database and will work.

This is a ASP question also and you'll get far better responses in the ASP forum forum333

____________________________________________________
[sub]The most important part of your thread is the subject line.
Make it clear and about the topic so we can find it later for reference. Please!! faq333-3811[/sub]
onpnt2.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top