Run-Time error '-2147417848 (80010108)'

prkchpsnaplsaws

New Member
Joined
Sep 15, 2020
Messages
3
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
 

Some videos you may like

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

prkchpsnaplsaws

New Member
Joined
Sep 15, 2020
Messages
3
Office Version
  1. 365
Platform
  1. Windows
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
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
36,101
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
You can't attach files here.

Is your worksheet protected?
 

Watch MrExcel Video

Forum statistics

Threads
1,122,850
Messages
5,598,457
Members
414,239
Latest member
xnanx

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
Top