Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can i clear the form data

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
when i press button to add the record , i write SQL statment in VBA using RunSQL function but i want to clear the values in the text boxes to insert another record >

there is a method :
text1.value=""
text2.value=""

but i need another method (more simple)
 
This code will create a new record...
Just add it to a button named btnNewRecord on the Click event.

P.S. the button wizard can also create this code for you....

Private Sub btnNewRecord_Click()
On Error GoTo Err_btnNewRecord_Click

DoCmd.GoToRecord , , acNewRec

Exit_btnNewRecord_Click:
Exit Sub

Err_btnNewRecord_Click:
MsgBox Err.Description
Resume Exit_btnNewRecord_Click

End Sub

Grtz,

Kalin
 
Hello!!!
Just add this to the code you have on the command button!!

me.dataentry = true

This will clear all the fields and create a new record!!
Fare well...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top