Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21090

Run-time error '42': Object required:

$
0
0
The program I created has a 5 Forms. 3 of the Forms are the main ones Main, Add and Edit form.
Everytime I edit(Edit Form) a Data from the Listview and click save command I get a bug;
Run-time error '42': Object required and
MsgBox Error.Description, vbExclamation, "Error"

Code:

Private Sub Form_Activate()
FindRecordset "Select * From Finder Where Owner = '" & txtOwner & "';"
If Not FindRs.BOF = True Or FindRs.EOF = False Then
txtOwner.Text = FindRs.Fields("Owner")
cboStatus.Text = FindRs.Fields("Status")
cboSchool.Text = FindRs.Fields("School")
cboDepartment.Text = FindRs.Fields("Department")
txtAcquired.Text = FindRs.Fields("Acquired")
txtReleased.Text = FindRs.Fields("Released")
txtIDNumber.Text = FindRs.Fields("IDNumber")
Else
End If
End Sub
_____________________________________________________________________________________________________________________________
Private Sub cmdUpdate_Click()
On Error GoTo errorupdate
If txtOwner.Text = vbNullString Or txtAcquired.Text = vbNullString Or txtReleased.Text = vbNullString Or cboStatus.ListIndex = -1 Then
MsgBox "Please fill the required fields in order to save.", vbExclamation, "Saving Status"
Exit Sub:
End If
executeQuery "UPDATE Finder SET Owner = '" & txtOwner & "', Acquired = '" & txtAcquired & "', Released = '" & txtReleased & "', Department = '" & cboDepartment & "', School = '" & cboSchool & "', Status = '" & cboStatus & "' Where IDNumber = '" & txtIDNumber & "';"
Unload Me
MsgBox "I.D. successfully Updated.", vbInformation, "Update Success"
Call RefreshListview
Exit Sub:
errorupdate:
MsgBox Error.Description, vbExclamation, "Error"
Set FindCon = Nothing
Set FindRs = Nothing
End
End Sub

I do not know why I got that error. I recheck and did review all the objects in the View Object, but don't know why the error is still persistent.
Been checking the program for almost 2hours now :(

Viewing all articles
Browse latest Browse all 21090

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>