Run-Time error '-2147417848 (80010108)'

prkchpsnaplsaws

New Member
Joined
Sep 15, 2020
Messages
4
Office Version
  1. 365
Platform
  1. Windows
I'm having an issue any time I run my "CheckOutButton" script to add data to a table on my sheet, and that is that it produces an error that pops up a box in excel stating:

Run-Time error '-2147417848 (80010108)': Method 'Add' of object 'ListRows' failed

But as soon as the box appears, excel freezes, so I cannot click "debug" and i can only force close Excel from Task Manager.

I've poured over it for the last 14 hours, trying everything I can find related to the error displayed from the first 3 pages of Google results, and nothing works.

Any help - at all - is most appreciated

Launch the UserForm w/ the button, test it with any Staff ID and any Asset ID, but to make it quick, you can use:

Staff ID: 715
Asset ID: 100
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
I cannot figure out how to attach my workbook (maybe I'm too new?) so ill post my code:

VBA Code:
Private Sub CancelButton_Click()

Unload CheckOutAsset

End Sub

Private Sub CheckInButton_Click()

End Sub

[B]Private Sub CheckOutButton_Click()

Dim ws As Worksheet
Dim newLogRow As String
Dim availChange As Range



Set ws = Sheets("Log"): Set tbl = ws.ListObjects("EquipLog")
    With tbl
        RowRef = .ListRows.Count
        .ListRows.Add
        .DataBodyRange(RowIndex:=RowRef, columnindex:=1).Value = Me.StaffID
        .DataBodyRange(RowIndex:=RowRef, columnindex:=2).Value = Me.AssetID
        .DataBodyRange(RowIndex:=RowRef, columnindex:=3).Value = Me.DynLabelCondition.Caption
        .DataBodyRange(RowIndex:=RowRef, columnindex:=4).Value = "Checked Out"
        .DataBodyRange(RowIndex:=RowRef, columnindex:=5).Value = Format(Now(), "hh:mm:ss")
        .DataBodyRange(RowIndex:=RowRef, columnindex:=6).Value = Format(Now(), "mm-dd-yyyy")
        .DataBodyRange(RowIndex:=RowRef, columnindex:=7).Value = DynLabelName.Caption
        .DataBodyRange(RowIndex:=RowRef, columnindex:=8).Value = DynLabelAsset.Caption
        .DataBodyRange(RowIndex:=RowRef, columnindex:=9).Value = Application.UserName

    End With
    
        
        
        
        
        Set availChange = Sheets("Assets").Columns("A").Find(AssetID.Text, , xlValues, xlWhole, 1, 1, 0)
            availChange.Offset(0, 4).Value = "Out"
            availChange.Offset(0, 5).Value = DynLabelName
            


StaffID.Text = ""
AssetID.Text = ""
CheckOutAsset!StaffID.SetFocus

End Sub[/B]



Private Sub DeleteButton_Click()

Dim iExit As VbMsgBoxResult
Dim i As Integer

iExit = MsgBox("Are you sure you want to delete this record?  It cannot be undone!", vbQuestion + vbYesNo, "Confirm Record Deletion")

    With Me.assetLogDisplay
        If .ListIndex > -1 Then
            Sheet1.ListObjects(1).ListRows(.ListIndex + 1).Delete
        End If
    End With

End Sub

Private Sub Label3_Click()

End Sub

Private Sub SearchButton_Click()

End Sub

Private Sub StaffID_Change()

    With Worksheets("Employees")
    
       On Error Resume Next
       
If Len(StaffID.Text) > 0 Then

x = .Columns(1).Find(StaffID.Text, LookIn:=xlValues, Lookat:=xlWhole).Row

If x > 0 Then

    DynLabelName.Caption = .Cells(x, 2).Value

Else
    
        DynLabelName.Caption = "ID# Not Found"
    
    End If
 
Else

DynLabelName.Caption = ""
    
End If
    
On Error GoTo 0
End With


If StaffID.Text > "" Then

        AssetID.Enabled = True

    Else

        AssetID.Enabled = False
    
End If


End Sub

Private Sub AssetID_Change()

With Worksheets("Assets")
On Error Resume Next


x = .Columns(1).Find(AssetID.Text, LookIn:=xlValues, Lookat:=xlWhole).Row

    
    assetName = .Cells(x, 2).Value
    assetCond = .Cells(x, 4).Value
    assetAvail = .Cells(x, 5).Value
    outTo = .Cells(x, 6).Value
    

    DynLabelAsset.Caption = assetName
    DynLabelCondition.Caption = assetCond
        


If assetAvail = "In" And assetCond = "Good" And StaffID.Text > "" Then

                    CheckOutButton.Enabled = True
                    CheckOutButton.BackColor = &H80FF&
                    DynLabelAvailable.Caption = "Ready To Checkout!"
                    
                    
    Else
    
                    CheckOutButton.Enabled = False
                    CheckOutButton.BackColor = &HC0C0C0


End If





If StaffID.Text > "" And assetAvail = "In" And assetCond = "Good" Then

                    CheckOutButton.Enabled = True
                    CheckOutButton.BackColor = &H8000&
                    DynLabelAvailable.Caption = "Ready To Checkout!"
                    
                    
    ElseIf StaffID.Text > "" And assetAvail = "Out" And assetCond > "" Then
                    
                    CheckInButton.Enabled = True
                    CheckInButton.BackColor = &H8000&
                    DynLabelAvailable.Caption = "Ready To Check Back In!"
    
    
    ElseIf StaffID.Text > "" And assetAvail = "Repair" Then
    
                    CheckInButton.Enabled = True
                    CheckInButton.BackColor = &H8000&
                    DynLabelAvailable.Caption = "Has this item been repaired?"
    
    
    
    Else
    
    
                    CheckOutButton.Enabled = False
                    CheckOutButton.BackColor = &HC0C0C0
                    CheckInButton.Enabled = False
                    CheckInButton.BackColor = &HC0C0C0
                    DynLabelAvailable.Caption = ""



End If




On Error Resume Next




End With
End Sub



Private Sub UserForm_Initialize()

Me.lblDate.Caption = "Today: " & Format(Now(), "mmm-dd-yyyy")


If StaffID.Text > "" Then

       AssetID.Enabled = True

   Else

       AssetID.Enabled = False
    
End If


LastAddress = Sheet1.Range("EquipLog").End(xlUp).Address

assetLogDisplay.ColumnCount = 10
assetLogDisplay.ColumnWidths = "1.4in,1in,1in,1in,0.75in,1in,1.5in,1.5in,1.25in, 1in"
assetLogDisplay.RowSource = Sheet1.ListObjects(1).DataBodyRange.Address(1, 1, xlA1, True)
'assetLogDisplay.RowSource = "'" & "Log" & "'!" & Range("EquipLog").Address

CheckOutAsset!StaffID.SetFocus

End Sub
 
Upvote 0
You can't attach files here.

Is your worksheet protected?
 
Upvote 0

Forum statistics

Threads
1,214,819
Messages
6,121,746
Members
449,050
Latest member
excelknuckles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top