View Single Post
 
Old 03-29-2019, 03:04 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,138
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Presumably you have other controls on the form such as the control button that cause the error. You could use an alternative approach e.g.


Code:
Private Sub cmdClear_Click()
Dim cControl As Control
    For Each cControl In Me.Controls
        Select Case TypeName(cControl)
            Case Is = "TextBox", "ComboBox"
                cControl = vbNullString
            Case Else
        End Select
    Next
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote