vbuser1976
Oct 30th, 2000, 02:12 PM
Hi forum buddies!
Please HELP! In my application, I have a form that is basically a data entry screen. Once the user has entered all data requested and clicked save, the form is supposed to save the data in the fields, but I am getting this error when I begin to assign form fields to the fields in SQL:
Run-time error '-2147217887 (80040e21)':
Multiple-step operation generated errors. Check each status value.
Can anyone tell me what this error means, why it occured, and how to solve it? Below is the code I am using just in case you need it.
Thanks again.
Code:
Private Sub ProcessData() 'This procedure processes and saves the inputted data
'to the database
Dim response As Integer
Dim rs As ADODB.Recordset
Dim strSQL As String
txtRepId.Text = "0"
strSQL = "Exec sp_get_report_id " & txtRepId.Text
Set rs = New ADODB.Recordset
Set rs.ActiveConnection = cn
rs.Source = strSQL
rs.CursorLocation = adUseClient
rs.LockType = adLockOptimistic
rs.CursorType = adOpenKeyset
rs.Open , , , , adCmdText
If (txtRepId.Text = 0 Or txtRepId.Text = "") Then
rs.AddNew
End If
With rs
.Fields("AtmId") = txtAtmId.Text 'This is where the cursor stops and gives me above mentioned error.
.Fields("ContactName") = txtContName.Text
.Fields("ContactPhone") = txtContPhone.Text
.Fields("DOccurence") = txtDoccur.Text
.Fields("NOccurence") = txtNature.Text
.Fields("ServiceTech") = lstSvcTech.Text
.Fields("STDate") = txtSvcDate.Text
.Fields("STTime") = txtSvcTime.Text
.Fields("SCrew1") = lstSCrew1.Text
.Fields("SCrew2") = lstSCrew2.Text
.Fields("SCrew3") = lstSCrew3.Text
.Fields("SCDate") = txtSCDate.Text
.Fields("SCTime") = txtSCTime.Text
.Fields("Resolution") = txtResolution.Text
.Fields("Result") = txtResult.Text
.Fields("DateReported") = txtTodaysDate.Text
.Fields("ReportedBy") = txtUserName.Text
.Fields("EmailTo") = lstEmailTo.Text
End With
rs.Update
'txtRepId.Text = rs.Fields("ReportId")
response = MsgBox("Your Report Id is " & rs.Fields("ReportId") & _
".", vbOKOnly, Title:="Your Report Id")
End Sub
Please HELP! In my application, I have a form that is basically a data entry screen. Once the user has entered all data requested and clicked save, the form is supposed to save the data in the fields, but I am getting this error when I begin to assign form fields to the fields in SQL:
Run-time error '-2147217887 (80040e21)':
Multiple-step operation generated errors. Check each status value.
Can anyone tell me what this error means, why it occured, and how to solve it? Below is the code I am using just in case you need it.
Thanks again.
Code:
Private Sub ProcessData() 'This procedure processes and saves the inputted data
'to the database
Dim response As Integer
Dim rs As ADODB.Recordset
Dim strSQL As String
txtRepId.Text = "0"
strSQL = "Exec sp_get_report_id " & txtRepId.Text
Set rs = New ADODB.Recordset
Set rs.ActiveConnection = cn
rs.Source = strSQL
rs.CursorLocation = adUseClient
rs.LockType = adLockOptimistic
rs.CursorType = adOpenKeyset
rs.Open , , , , adCmdText
If (txtRepId.Text = 0 Or txtRepId.Text = "") Then
rs.AddNew
End If
With rs
.Fields("AtmId") = txtAtmId.Text 'This is where the cursor stops and gives me above mentioned error.
.Fields("ContactName") = txtContName.Text
.Fields("ContactPhone") = txtContPhone.Text
.Fields("DOccurence") = txtDoccur.Text
.Fields("NOccurence") = txtNature.Text
.Fields("ServiceTech") = lstSvcTech.Text
.Fields("STDate") = txtSvcDate.Text
.Fields("STTime") = txtSvcTime.Text
.Fields("SCrew1") = lstSCrew1.Text
.Fields("SCrew2") = lstSCrew2.Text
.Fields("SCrew3") = lstSCrew3.Text
.Fields("SCDate") = txtSCDate.Text
.Fields("SCTime") = txtSCTime.Text
.Fields("Resolution") = txtResolution.Text
.Fields("Result") = txtResult.Text
.Fields("DateReported") = txtTodaysDate.Text
.Fields("ReportedBy") = txtUserName.Text
.Fields("EmailTo") = lstEmailTo.Text
End With
rs.Update
'txtRepId.Text = rs.Fields("ReportId")
response = MsgBox("Your Report Id is " & rs.Fields("ReportId") & _
".", vbOKOnly, Title:="Your Report Id")
End Sub