Clearing a textbox in a form

shaz123

Registered User.
Local time
Today, 03:09
Joined
Sep 8, 2006
Messages
81
I have a command button on a form which i would like to click on to clear all the textbox on a form. Witihn the event procedure of the command button i have tried cylindernumber = "". This does clear the text box however it deletes the information from the table to, which i do not want to happen. I just wnat the text box to be clear once the button is clicked on without deleting the information from the table.
 
Try this

Private Sub "nameofbutton"_Click()
Dim intIndex As Integer

cylindernumber = ""

End Sub

I think it should work

Andy
 
If you want to clear the form to enter a new record use
Code:
DoCmd.GoToRecord , , acNewRec
If you use a bound form this is the way to create a empty form.
 
Thankyou, for your help both of u, i tried both ways and for what i was trying to do this coding worked "DoCmd.GoToRecord , , acNewRec".


Thank alot
 
thats not quite the same as clearing the text box - it is instead navigating your form to be able to enter a new record, which may be what you want.

if you are in a bound form, where your data is linked to a table, then changing data in a text box WILL always affect the underlying data, as you experienced.
 

Users who are viewing this thread

Back
Top Bottom