user2119980
user2119980

Reputation: 509

Getting Textboxes to Clear after use

I have an access form where I input data into them to be inserted into a table for storage, the code I use is

Private Sub cmd_go_Click()
Dim insertstring As String

insertstring = "INSERT INTO KWTable (KW, Source, Code) VALUES('" & text_key.Value & "','" &         combo_source.Value & "','" & txt_code.Value & "');"

DoCmd.RunSQL insertstring

End Sub

And I was wondering if there was a code I could add to this so that once the data has been inserted the text box and the combo box would automatically clear?

Upvotes: 0

Views: 254

Answers (1)

Barranka
Barranka

Reputation: 21047

Use the properties of the controls. Specifically, try setting the .Text or .Value properties to "":

txtTextBox.Text = ""

Or:

txtTextBox.Value = ""

Upvotes: 1

Related Questions