Clear contents of an unbound text box on a bound form.

  • Thread starter Thread starter Dave K.
  • Start date Start date
D

Dave K.

I would like to clear the contents of an unbound text box in access 2003. I
have several unbound text boxes that I enter numbers and then press a command
button that runs a macro to add them up and enter the total into a bound
field (like a calculator). I also have a command button that goes to a new
record. I need to clear the contents of the unbound boxes when I goto the
new record.
 
Do you mean a new record or a different record or both ?

In the On Current event of the form you can put this code

Me.TextBox1 = ""
Me.TextBox2 = ""
etc.

if you only want to clear thjem on a new record then put an if around the
lines

If Me.NewRecord = True Then
Me.TextBox1 = ""
Me.TextBox2 = ""
etc.
End If
 
Thanks I actual just just put in the command button for a new record and It
works fine.

Private Sub AddRecord_Click()
On Error GoTo Err_AddRecord_Click


DoCmd.GoToRecord , , acNewRec
Me.Check1 = 0
Me.Check2 = 0
Me.Check3 = 0
Me.Check4 = 0
Me.Check5 = 0
DoCmd.GoToControl "date"

Exit_AddRecord_Click:
Exit Sub

Err_AddRecord_Click:
MsgBox Err.Description
Resume Exit_AddRecord_Click

End Sub
 
Back
Top