A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

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



 
 
Thread Tools Display Modes
  #1  
Old December 8th, 2009, 02:29 PM posted to microsoft.public.access.forms
Dave K.
external usenet poster
 
Posts: 30
Default Clear contents of an unbound text box on a bound form.

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.
--
Dave K.
  #2  
Old December 8th, 2009, 02:49 PM posted to microsoft.public.access.forms
RonaldoOneNil
external usenet poster
 
Posts: 345
Default Clear contents of an unbound text box on a bound form.

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

"Dave K." wrote:

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.
--
Dave K.

  #3  
Old December 8th, 2009, 06:21 PM posted to microsoft.public.access.forms
Dave K.
external usenet poster
 
Posts: 30
Default Clear contents of an unbound text box on a bound form.

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
--
Dave K.


"RonaldoOneNil" wrote:

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

"Dave K." wrote:

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.
--
Dave K.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:38 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.