Hi Jennie,
Did you make some change to the data in any field, in order to "dirty" the
record? If you have the record selector displayed on the form, a pencil
symbol is displayed to indicate that the record is dirty. Unless each record
is made dirty (ie. edited), the Form_BeforeUpdate procedure will not run.
Do you have the most important "Option Explicit" as the second line of code
in your form module? If not, please see this article for the reason why you
want this, and how to configure your VBE environment so that all new modules
will include Option Explicit:
Always Use Option Explicit
http://www.access.qbuilt.com/html/gem_tips.html#VBEOptions
Does your code compile okay without any errors (Debug > Compile ProjectName)
from the VBE editor?
Tom
http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________
:
I put that code in the BeforeUpdate property of the form, but it does still
not prompt for the TermDate field to be populated.
__________________________________________
:
Hi Jennie,
Yes, you can do this. Add the validation code to the Form_BeforeUpdate event
procedure. Something like this (untested):
Option Compare Database
Option Explicit
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo ProcError
If Me.Active = True Then
If Len(Me.TermDate) = 0 Then 'No entry was made
MsgBox "You must enter a Term Date.", vbInformation, _
"Missing Term Date Value..."
Cancel = True
Me.TermDate.SetFocus
End If
End If
ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in procedure Form_BeforeUpdate..."
Resume ExitProc
End Sub
Tom
http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________
:
I have the following code written to my check box:
Private Sub Active_AfterUpdate()
If Me.Active = True Then
Me.TermDate.Enabled = False
Else
Me.TermDate.Enabled = True
End If
End Sub
I would also like to make the TermDate field a required field IF the Active
check box = True, but not required if the checkbox = False. Is there any way
I can do that?