A
Arnold Klapheck
I tried using the following two methods to code this and get error messages
as noted in comments.
Private Sub btnClearForm_Click()
Dim ctl As Control
For Each ctl In Me.Controls
If (Me.ctl.ControlType = acTextBox) Then 'error method or data
member error cont. not found, highlights (.ctl)
If Me.ctl.DefaultValue <> "" Then 'if have default value
put it in textbox
Me.ctl.Value = Me.ctl.DefaultValue
Else
Me.ctl.Value = ""
End If
End If
Next ctl
'I also tried it this way
Dim i As Integer
For i = 0 To Me.Count - 1
If TypeOf Me(i) Is TextBox Then
Me(i).Value = "" ' error can't assign a value
End If
Next i
End Sub
I have been stuck on this for a while, help would be appreciated
as noted in comments.
Private Sub btnClearForm_Click()
Dim ctl As Control
For Each ctl In Me.Controls
If (Me.ctl.ControlType = acTextBox) Then 'error method or data
member error cont. not found, highlights (.ctl)
If Me.ctl.DefaultValue <> "" Then 'if have default value
put it in textbox
Me.ctl.Value = Me.ctl.DefaultValue
Else
Me.ctl.Value = ""
End If
End If
Next ctl
'I also tried it this way
Dim i As Integer
For i = 0 To Me.Count - 1
If TypeOf Me(i) Is TextBox Then
Me(i).Value = "" ' error can't assign a value
End If
Next i
End Sub
I have been stuck on this for a while, help would be appreciated