Thanks for reading my post.
Probably I was not very clear. When the user tries to leave the form I
already have this code that check that all the subforms in the main form are
filled out:
Private Sub Form_Unload(Cancel As Integer)
'Main form will not be closed until both subforms "sfrm10" & "sfrm11" &
"sfrm12" have at least one value
If IsNull([sfrm10].Form![SubobjectiveNumber]) Then
Cancel = True
MsgBox "You cannot close the MAIN form unless you selected at least
one Subobjective!", vbInformation, "Information"
End If
If IsNull([sfrm11].Form![CISICode]) Then
Cancel = True
MsgBox "You cannot close the MAIN form unless you selected at least
one CISI!", vbInformation, "Information"
End If
If IsNull([sfrm12].Form![Person]) Then
Cancel = True
MsgBox "You cannot close the MAIN form unless you selected at least
one Resource (Person)!", vbInformation, "Information"
End If
End Sub
Now I want to put this code in some place and in response to the event "the
user is changing record" to check whether all the subform are filled out or
not.
Thanks for your collaboration.
Ofer said:
I'm not sure if that what you are looking for, but you can use the before
update event of the subform, and write the code
If IsNull(Me.[Field1Name]) Or IsNull(Me.[Field2Name]) Then
MsgBox "Must fill fields"
cancel = true ' wont let exit the record
End If
--
\\// Live Long and Prosper \\//
BS"D
kory said:
I have a form with a subform and I would like to make me sure that the
user
has filled the sunform when he/she tries to change record using the
normal
button in a form. I am not able to figure out where I should put the code
to
carry out this check. I already check the subform when the user try to
close
the form (form_unload() event) and it works but no clue about the record
chenge.
Thanks.