reclusivemonkey
Registered User.
- Local time
- Today, 00:56
- Joined
- Oct 5, 2004
- Messages
- 749
Just going through a DB today and I was struck by an idea... I was writing code to check fields for data, and if they were empty I was prompting the user. Now I usually try to fill in the status bar text and control tip text with some like "Please select a month" or whatever. So, I came up with this;
Now of course if you don't populate the ControlTipText or the StatusBarText then its not much good, but I was quite pleased with myself. I am sure someone can write this to use an array and make it generally more useful...
Code:
Public Function CheckForEntry(ByRef myControl As Variant)
' Why write a check for an entry in each control when we can function it?
If IsNull(myControl) Then
If IsNull(myControl.ControlTipText) Then
MsgBox "Please check you have completed all the necessary fields."
DoCmd.GoToControl myControl.Name
Else
MsgBox myControl.ControlTipText
DoCmd.GoToControl myControl.Name
End
End If
Else
End If
End Function
Now of course if you don't populate the ControlTipText or the StatusBarText then its not much good, but I was quite pleased with myself. I am sure someone can write this to use an array and make it generally more useful...