Do you know how to put that code in the right event?
Do you know how to put that code in the right event?
Worked.
I have put another macro which I found my online search and kept under the above code.
Now when I try to input in my input boxes it shows warning : If "Form1" is a new macro group, make sure you have saved it and that you have typed its name correctly.
Is the two macro clashing ?
Its the other code which I kept below your macro code. Yes I know hoe to put the code[selected input box, then build event and inside code builder]
Private Sub Command1_Click()
Dim ctrl As Control
For Each ctl In Form.Controls
If TypeOf ctl Is TextBox Then
ctl.SetFocus
ctl.Text = ""
End If
Next
End Sub
Did you put that code in the Click event of a button on your form?
Yes RG I have put that code in the Click event of a button on my form to clear the text box inputs.
Go ahead and post ALL of the code in your form's code module.
nope not working RG.
Copy and paste your code module into a post so we can see what you have.
Private Sub Text2_BeforeUpdate(Cancel As Integer)
If InStr(Me.Text2, "*") Then
MsgBox "You are using and asterisk '*'", vbCritical + vbOKOnly
End If
End Sub
Private Sub Reset_Click()
Dim ctrl As Control
For Each ctl In Form1.Controls
If TypeOf ctl Is TextBox Then
ctl.SetFocus
ctl.Text = ""
End If
Next
End Sub
Try changing your button code to:
Code:Private Sub Reset_Click() Dim ctl As Control For Each ctl In Me.Controls If TypeOf ctl Is TextBox Then ctl = "" End If Next End Sub
Thanks it worked. Well can I add the star macro code with the search button of the form so that instead of giving waring on entry let it show warning on clicking the search button.
Have you tried it?
No not tried it. perhaps some if else may help not sure.