PennyPitSt0p
Access 2000 Amateur
- Local time
- Today, 15:30
- Joined
- Mar 2, 2006
- Messages
- 16
Let me start by saying that this is the first database that I have ever put Modules & VBA into. So I am REALLY new, so be gentle with me.
Also, I am using some code provided by my boss who has some knowledge of this, but is fairly new as well. So, if it is not on the right event type, have patience.
I have a form that is being used to track progress of work by our processors.
In the database, I have a combo field called status and a comment field. If the status = PENDING, I need to require something to be placed in the comment field.
I think that I am close, with the following code, however it will check once, give the message box and then let me save the record anyway without the comment.
Can anyone assist me with trying to button this down?
Thanks!
Private Sub Form_BeforeUpdate(Cancel As Integer)
'test comments if status = pending
Dim stat As String
Dim Comment As Variant
Dim mycheck
Dim ID As Integer
ID = Me!ID
Comment = Me!Comment
stat = Me!Status
If stat = "PENDING" Then
mycheck = IsNull(Comment)
If mycheck = True Then
Response = MsgBox("Please add a comment for pending merchants!", 0)
DoCmd.GoToControl "Comment"
End If
End If
End Sub
Also, I am using some code provided by my boss who has some knowledge of this, but is fairly new as well. So, if it is not on the right event type, have patience.

I have a form that is being used to track progress of work by our processors.
In the database, I have a combo field called status and a comment field. If the status = PENDING, I need to require something to be placed in the comment field.
I think that I am close, with the following code, however it will check once, give the message box and then let me save the record anyway without the comment.
Can anyone assist me with trying to button this down?
Thanks!
Private Sub Form_BeforeUpdate(Cancel As Integer)
'test comments if status = pending
Dim stat As String
Dim Comment As Variant
Dim mycheck
Dim ID As Integer
ID = Me!ID
Comment = Me!Comment
stat = Me!Status
If stat = "PENDING" Then
mycheck = IsNull(Comment)
If mycheck = True Then
Response = MsgBox("Please add a comment for pending merchants!", 0)
DoCmd.GoToControl "Comment"
End If
End If
End Sub