|
-
Feb 14th, 2004, 11:05 AM
#1
Thread Starter
New Member
OLE DB operation generated errors
I am getting the following err messages when inserting a new record into MS Access table.
Err.Number : -2147217887
Err.Decription : Multiple-step OLE DB operation generated errors.
Check each OLE DB status value, if available. No
work was done.
table design :
----------------
Name(text)
Addr1(text)
addr2(text)
place(text)
Cell(text)
I have not given any values for the fileds : Addr1,Addr2, Place, Cell when inserting into access table.
Note : Except the name field the settings of the other field are
“Required = No”
“Allow Zero Length=No”
Code :
-----------------------------------------------------------------------------
rs.Open “addr”, cn, adOpenDynamic, adLockOptimistic
rs.AddNew
rs!Name = txtName.Text
rs!addr1 = txtAddr1.Text
On Error GoTo errHandler
rs!addr2 = txtAddr2.Text (err in this statement)
rs!place = txtPlace.Text
rs!cell = txtCell.Text
rs.Update
rs.Close
-----------------------------------------------------------------------------
any tips?
-
Feb 14th, 2004, 12:53 PM
#2
I have not given any values for the fileds : Addr1,Addr2, Place, Cell when inserting into access table
“Allow Zero Length=No”
You don't see the conflict between the two statements above?
Allow Zero Length=No - means you cannot enter an empty space, ie "", which is what a text box contains if it is blank.
To fix the problem, allow zero length strings or check if the textbox is empty and if so bypass the statement (ie the database value will be Null).
VB Code:
If Len(Trim$(txtAddr2.Text)) > 0 Then
rs!addr2 = txtAddr2.Text
End if
If Len(Trim$(txtPlace.Text)) > 0 Then
rs!place = txtPlace.Text
End if
-
Feb 15th, 2004, 11:17 AM
#3
Thread Starter
New Member
interesting code
thaks 4 the tip
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|