Skip to content

Instantly share code, notes, and snippets.

@Phuseos
Created May 24, 2016 11:30
Show Gist options
  • Select an option

  • Save Phuseos/823b00d14ad0b185bbedb5175031c73c to your computer and use it in GitHub Desktop.

Select an option

Save Phuseos/823b00d14ad0b185bbedb5175031c73c to your computer and use it in GitHub Desktop.
Clear control values on current active form (VBA)
Option Compare Database
Function CleanForm()
'Call as CleanForm(), will clear current text & comboboxes on active form.
For Each ctl In Form.Controls 'Loop through controls of the form
Select Case ctl.ControlType
Case acTextBox, acComboBox 'Select Textboxes and Comboboxes (DropDownLists)
ctl.value = "" 'Set the value to ""
End Select
Next
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment