judgehopkins
Registered User.
- Local time
- Today, 14:03
- Joined
- May 29, 2003
- Messages
- 13
This code is for this situation: a user goes back to a saved record
(thus, undo in the before update event is no longer possible)
and changes a programmatically-required control
(i.e., the field is not made required in the table).
The code works EXCEPT for when it gets to MyControl.CheckBox = -1.
I just don't know the syntax. What is it?
Thanks!
(thus, undo in the before update event is no longer possible)
and changes a programmatically-required control
(i.e., the field is not made required in the table).
The code works EXCEPT for when it gets to MyControl.CheckBox = -1.
I just don't know the syntax. What is it?
Thanks!
Code:
Private Function ClearForm()
Dim MyForm As Form, MyControl As Control
For Each MyForm In Forms
For Each MyControl In MyForm.Controls
If TypeOf MyControl Is TextBox Then
MyControl.Enabled = True
MyControl.Visible = True
MyControl.SetFocus
MyControl.Text = ""
ElseIf TypeOf MyControl Is ComboBox Then
MyControl.Enabled = True
MyControl.Visible = True
MyControl.SetFocus
MyControl.ListIndex = -1
ElseIf TypeOf MyControl Is ListBox Then
MyControl.Enabled = True
MyControl.Visible = True
MyControl.SetFocus
MyControl.ListIndex = -1
ElseIf TypeOf MyControl Is CheckBox Then
MyControl.Enabled = True
MyControl.Visible = True
MyControl.SetFocus
MyControl.CheckBox = -1
End If
Next MyControl
Next MyForm
End Function