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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADODB .AddNew error 1

Status
Not open for further replies.

sfunk

Technical User
Jan 22, 2002
107
US
Hello,

I am getting an error when I am trying to add a record through adodb .addnew. The error is:
Run-time error '-2147217887(80040e21) Multiple-step operation generated errors. Check each status value.
When I hit debug it highlights the line:
.Fields!OpenDate = txtOpenDate(you will see it below in it's context.)

Here is the code that I am using:

Private Sub cmdSave_Click()

Dim Con As ADODB.Connection
Dim rst As ADODB.Recordset

Set Con = New ADODB.Connection
Con.CursorLocation = adUseClient
Con.Open "Provider = Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\sfunk\My Documents\JobTracker\jobTracker.mdb;Persist Security Info=False"

Set rst = New ADODB.Recordset 'specifying attributes to this recordset

With rst

.ActiveConnection = Con
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic

.Open "tbl_Job_Tracker"

End With

With rst
.AddNew
'.Fields!JobID =
.Fields!CompanyName = txtCompany
.Fields!Contact = txtContact
.Fields!Title = txtTitle
.Fields!OpenDate = txtOpenDate
.Fields!Address = txtAddress
.Fields!Phone = txtPhone
.Fields!Fax = txtFax
.Fields!Email = txtEmail
.Fields!URL = txtURL
.Fields!CorpURL = txtCorpURL
.Fields!SentResume = chkResumeSent
.Fields!FirstCall = chkFirstCall
.Fields!SecondCall = chkSecondCall
.Fields!LastCall = chkLastCall
.Fields!PendingAction = chkActionPending
.Fields!InterviewDate = txtInterviewDate
.Fields!FollowUpCall = chkFollowUpCall
.Fields!FollowUpCall2 = chkFollowUpCall2
.Fields!HearFromDate = txtHEarFromDate
.Fields!Notes = txtNotes
.Update
End With


cmdSave.Visible = False
End Sub


Sincerely,
Steve Funk
 
Does txtOpenDate contain a valid and properly formatted Date? Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
This value is null during this operation. Later it is add through an UPDATE.

Thanks.

Steve
(sorry about the duplicate posting, my keyboard seems to be possessed this morning) Sincerely,
Steve Funk
 
I'm not sure that the text box contains the value null, but rather a nullstring, which is not quite the same. You might try something like the following:

If (IsDate(txtOpenDate)) Then
.Fields!OpenDate = txtOpenDate
Else
.Fields!OpenDate = Null
End If

There are lots of threads with respect to the pros and cons, with alternatives for IsDate, but for this, it may be sufficient. Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top