Clearing fields in a form

bigbadbess24

Registered User.
Local time
Today, 07:56
Joined
Mar 9, 2006
Messages
83
I have a one page form set up into 4 different sections. Each section has its own command. First section is Radio buttons with a drop down list. The next three are text boxes. I have a rather simple question, next to my OK command button I want a to create a button that will say "Clear" and I want it to clear the text inside the text field but if possible to clear the radio buttons and the drop down list too. Its not a main concern about radio buttons because you can just unclick it. But I was not sure what the VB is for clearing text inside a text box.
Thank you.
 
bigbadbess24 said:
I have a one page form set up into 4 different sections. Each section has its own command. First section is Radio buttons with a drop down list. The next three are text boxes. I have a rather simple question, next to my OK command button I want a to create a button that will say "Clear" and I want it to clear the text inside the text field but if possible to clear the radio buttons and the drop down list too. Its not a main concern about radio buttons because you can just unclick it. But I was not sure what the VB is for clearing text inside a text box.
Thank you.

On the click event for that clean button but

me.textboxName = " "
me.textboxName2 = " "
etc.

me.radiobuttonname = false
me.checkbox name = false

etc
 
Thank you, that was helpful
 
bigbadbess24 said:
Thank you, that was helpful

Also, I have done for mine in the past, gave a message box to ask them to make sure they want to clear it. I know most people hate those, but it has saved my data before.

good luck
 
That is a good idea. You happen to have the VB for a message box too?
 
bigbadbess24 said:
That is a good idea. You happen to have the VB for a message box too?
Yeah,




Code:
Private Sub ClearButton_Click()

Dim intResponse As Integer

intResonse =  MsgBox("Are you sure you want to clear the text Boxs", vbYesNo, Change)

IF intResponse = 6 then
   me.textboxname.value = " "
   me.textboxName2.value = " "
   me.checkboxname = false
   me.radiobutton = false

else

end if

end sub
 
I actually figure it out but yours help. Is there anyway to change the fonts of the message? I try to play around with it and all it changed was the command fonts. And at the top of the message box it says Microsoft Access, anyway to change that?
 
bigbadbess24 said:
I actually figure it out but yours help. Is there anyway to change the fonts of the message? I try to play around with it and all it changed was the command fonts. And at the top of the message box it says Microsoft Access, anyway to change that?


There is a argument to the message box control. It is the title argument.
 
Thanks again for your help. I just have a few questions. What does the "Change" mean after vbYesNo? Why is there a 6 after the IF intResponse=6, what does that mean?
I tried using your VB, I put it in and I get the Yes No screen, when I hit Yes nothing clears.
 
VB Script

Below is my VB script

Private Sub Command26_Click()
Dim intResponse As Integer
intReponse = MsgBox("Are you sure you want to clear the boxes?", vbYesNo, Change)
If intResponse = 6 Then
Me.chk9 = False
Me.chks10 = False
Me.chk11 = False
Me.Chk12 = False
Me.cboDistrict.Value = ""
Else
End If
End Sub
 
bigbadbess24 said:
Below is my VB script

Private Sub Command26_Click()
Dim intResponse As Integer
intReponse = MsgBox("Are you sure you want to clear the boxes?", vbYesNo, Change)
If intResponse = 6 Then
Me.chk9 = False
Me.chks10 = False
Me.chk11 = False
Me.Chk12 = False
Me.cboDistrict.Value = ""
Else
End If
End Sub

6 means yes and 7 means no.

And 'change' is a title. You can remove that if you like. Not sure why it isn't working. Can you post your DB?
 
In the Form its the command button called "Command 37"
 
Last edited:
Rich said:
Why not just
Me.Undo ?

Because I didn't know that was a method of a control text box.

Thanks Rich. :D
 

Users who are viewing this thread

Back
Top Bottom