G
Guest
Hello, I have hit a block and was hoping someone might know the answer to
this. I have a form with a subform in it. Users need to enter their
initials in one or the other if they have changed anything on either of these
forms which works fine however the users have requested that the message only
occur when they change a record not when changing from the main form to the
subform. Sounds logical however I can not seem to make this function in that
manner. I have tried using the oncurrent event but that creates an error
based on trying to open the form. Currently my code reads as follows:
Private Sub Form_BeforeUpdate(Cancel As Integer)
' Display message if UpdatedBy is blank.
Dim strMsg As String, strTitle As String
Dim intStyle As Integer
If IsNull(Me!UpdatedBy) Or Me!UpdatedBy = "" Then
strMsg = "You must put your initials in the Updated By box."
strTitle = "Initials Required"
intStyle = vbOKOnly
MsgBox strMsg, intStyle, strTitle
Me![UpdatedBy].SetFocus
Cancel = True
End If
End Sub
I am sure its something I am just missing but any help would be soooo
appreciated.
Thanks
this. I have a form with a subform in it. Users need to enter their
initials in one or the other if they have changed anything on either of these
forms which works fine however the users have requested that the message only
occur when they change a record not when changing from the main form to the
subform. Sounds logical however I can not seem to make this function in that
manner. I have tried using the oncurrent event but that creates an error
based on trying to open the form. Currently my code reads as follows:
Private Sub Form_BeforeUpdate(Cancel As Integer)
' Display message if UpdatedBy is blank.
Dim strMsg As String, strTitle As String
Dim intStyle As Integer
If IsNull(Me!UpdatedBy) Or Me!UpdatedBy = "" Then
strMsg = "You must put your initials in the Updated By box."
strTitle = "Initials Required"
intStyle = vbOKOnly
MsgBox strMsg, intStyle, strTitle
Me![UpdatedBy].SetFocus
Cancel = True
End If
End Sub
I am sure its something I am just missing but any help would be soooo
appreciated.
Thanks