Hollis,Virginia
HollisVJ at pgdp.usec.com
Tue Aug 17 08:07:40 CDT 2004
I am having problems on the close button of my form. I want to make sure
certain fields are completed before they close the form. I am trying to use
IsDirty so the form closes if there hasn't been any changes made and also if
all the fields have been completed. I am using the below code and receive
the error, object not supported. This is a form/subform and the close button
is on the subform. If I remove the IsDirty, it works.
If Forms!frmEvalMain.frmEvalSub.Dirty = True Then 'Data Entered? Yes
If Len(TypeID & "") = 0 Then
MsgBox "You must enter a Type." & vbCrLf, vbCritical, " Entry
Required"
TypeID.SetFocus
ElseIf Len(Title & "") = 0 Then
MsgBox "A title must be entered." & vbCrLf, vbCritical, " Entry
Required"
Title.SetFocus
ElseIf Len(Author & "") = 0 Then
MsgBox "An Author must be entered." & vbCrLf, vbCritical, " Entry
Required"
Author.SetFocus
Else
response = MsgBox("Do you want to Exit?", vbYesNo + vbQuestion,
"Exit")
If response = vbNo Then
Title.SetFocus
Else
DoCmd.RunCommand acCmdSaveRecord
DoCmd.Close acForm, "frmEvalMain"
End If
End If
Else
DoCmd.Close acForm, "frmEvalMain"
End If
Virginia