Can some one please tell me what I am doing incorrectly, the ElseIf is working But not the If. Thanks Tim
Sub ClearFormText(frm As Form)
Dim ctl As Control
For Each ctl In frm.Controls
If ctl.ControlType = acTextBox And ctl.Tag = "*" Then
If ctl.Name = "txtNewField" Or ctl.Name = "txtNewField1" Then
txtNewField = Hcpc
txtNewFieldi = Description
ElseIf ctl.ControlType = acTextBox Then
ctl.Value = ""
End If
End If
Next ctl
'Call the code from any event with the following syntax:
'ClearFormText Me
'The 'Me' keyword will pass in a reference to the current
'form and the code will clear all text boxes.
End Sub
Sub ClearFormText(frm As Form)
Dim ctl As Control
For Each ctl In frm.Controls
If ctl.ControlType = acTextBox And ctl.Tag = "*" Then
If ctl.Name = "txtNewField" Or ctl.Name = "txtNewField1" Then
txtNewField = Hcpc
txtNewFieldi = Description
ElseIf ctl.ControlType = acTextBox Then
ctl.Value = ""
End If
End If
Next ctl
'Call the code from any event with the following syntax:
'ClearFormText Me
'The 'Me' keyword will pass in a reference to the current
'form and the code will clear all text boxes.
End Sub