Reset Form

Tezdread

Registered User.
Local time
Today, 14:22
Joined
Jul 11, 2002
Messages
105
Hi, I am using a form that contains combo boxes and text boxes to carry out a search, this all works fine but I would also like to have a Reset button to clear the contents of the form.

I have tried the Reset option in RunCommand in Macros but this doesn't work. The fields within the table are unbound and they need to be this way because they are only input fields.

I have setup a macro that closes the form and re-opens it and this works but is there another way I can Reset the contents of a form when the fields are unbound?

:cool: Tezdread
 
Not sure if this is the correct way of doing it but it does the job for me.

On the on click property of your button try the following code

'Private Sub Command68_Click()

Dim ctl As Control
For Each ctl In Me.Controls

Select Case ctl.ControlType

Case acComboBox
ctl.Value = Null

Case acTextBox
ctl.SetFocus
ctl.Text = ""

End Select
Next ctl


'End Sub

Hope this helps you

Steve
 
That worked a treat! Thanks a lot
 
Hi I have used the code quoted above and it works perfected until it gets to a text box which is dependant on one of the other controls. Is there a way I can skip this text box only. The text box is called tbLotQty. I have tried using If statements but the can't get the For Each and Next sections in the correct place.

Hannah
 

Users who are viewing this thread

Back
Top Bottom