Here is my code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strMsg As String
If IsNull(Me![fHDHPSalaryBand subfrm].Form!SalaryBand) Then
Cancel = True
strMsg = strMsg & "Must complete data entry on this form before
record will be saved." & vbCrLf
End If
If Cancel Then
strMsg = strMsg & "Complete entry on this record or it will not be
saved."
MsgBox strMsg, vbExclamation, "Invalid data"
End If
End Sub
Can someone point out my error and a fix? Thanks.
It is not possible to move your focus to the subform, without the main
form record being saved. You will need to validate the main form record
on the main form's Before Update event, and validate the subform's
record on the subform's Before Update event.
--
Steve Schapel, Microsoft Access MVP
The user won't be able to exit the subform or move to a new record in the
subform until the BeforeUpdate validation is successful and the current
record is saved (which sets Dirty to False).
HTH,
--
George Nicholson
Remove 'Junk' from return address.
"Tracey" <Tra...@discussions.microsoft.com> wrote in message
news:A0B7994F-7C06-4477...@microsoft.com...
--
Steve Schapel, Microsoft Access MVP
--
George Nicholson
Remove 'Junk' from return address.
"Steve Schapel" <sch...@mvps.org.ns> wrote in message
news:Os5L1fIG...@TK2MSFTNGP12.phx.gbl...