Skip to content

Instantly share code, notes, and snippets.

@Phuseos
Created February 2, 2017 12:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Phuseos/e789dcedeac54ed7494f757cb625d242 to your computer and use it in GitHub Desktop.
Save Phuseos/e789dcedeac54ed7494f757cb625d242 to your computer and use it in GitHub Desktop.
Private Sub CleanFormTextboxes()
'Empty textboxes in the current form
'Loop through the controls
Dim ctrl As Control
Dim txt As TextBox
'If a textbox is found in the loop and the text is more then 1 character, empty it
For Each ctrl In Me.Controls
If TypeOf ctrl Is TextBox Then
Set txt = ctrl
If Len(txt.Value) > 0 Then txt.Value = Null
End If
Next ctrl
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment