PDA

View Full Version : Delete text from text box



kingJams
01-23-2006, 03:26 PM
I would like to use code to delete the text from a text box after saving the text. I have managed to get the save function to work but can't seem to get delete to work. The name of my text box is txtEnter. The name of the button to do both function is cmdSave. The delete code is:

Private Sub cmdDel_GotFocus()
On Error GoTo Err_cmdDel_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
txtEnter.Text = "Text"
Exit_cmdDel_Click:
Exit Sub

Err_cmdDel_Click:
MsgBox Err.Description
Resume Exit_cmdDel_Click
End Sub

OBP
01-23-2006, 03:47 PM
To clear the text box use
txtEnter = ""

kingJams
01-23-2006, 04:40 PM
OBP, thanks a million. I got it to work.