Allen Browne- DoMenuItem cancelled

S

Stephanie

Allen et al,
I'm still having problems with the routine to gather my
required fields into one msg box.

I enter a name and save, skipping all required fields. I
get the first prompt (select member/read). When I click
OK, I get the dreaded "DoMenuItem action was cancelled".
I click OK and then select member/read and click save.
Then a msg box pops up to tell me that I'm missing 3
other required fields (nifty!). I click OK. Then I
immediately get the dreaded "No current record" msg box.
So I populate some of the required fields (you know
users!). I get the appropriate combined required fields
prompt. When I click OK I get "DoMenuItem action was
cancelled". Am I doing something wrong? I've attached
the code here, with my conditionals. Thanks for the
help, Stephanie

Private Sub Form_BeforeUpdate(Cancel As Integer)
'On Error GoTo Err_Form_BeforeUpdate
Dim bWarn As Boolean 'Flag to warn user.
Dim strMsg As String 'MsgBox message.
'**************************************
'Handle required fields.
'**************************************
If (Me!Option1) = 0 And (Me!Option2) = 0 Then
Cancel = True
strMsg = strMsg & "Please select either 'ITA
Member' or 'R.E.A.D. Team '" & vbCrLf
End If
If IsNull(Me!MemberDateName) And ((Option1) = -1 Or
(Option2) = -1) Then
Cancel = True
strMsg = strMsg & "Please enter an 'Associated
Since' Date." & vbCrLf
End If
If ((Option1) = -1 Or (Option2) = -1) And ((Me!
MemberStatusName) = 0 Or (Me!MemberTypeName) = 0) Then
Cancel = True
strMsg = strMsg & "Please enter Member 'Status'
and 'Type'." & vbCrLf
End If
If ((Option1) = -1 Or (Option2) = -1) And IsNull(Me!
StateOrProvinceName) Then
Cancel = True
strMsg = strMsg & "Please enter the 2
letter 'State' code to continue." & vbCrLf
End If
'Concatenate other messages the same way.
'NOT USING WARNING (YET)
' If Not Cancel Then
' '**************************************
' 'Warning fields
' '**************************************
' If Me.BirthDate > Date Then
' bWarn = True
' strMsg = strMsg & "Born in the future?" &
vbCrLf
' End If
' 'etc for other warnings.
' End If

'Response
Call CancelOrWarn(Cancel, bWarn, strMsg)
End Sub
 
A

Allen Browne

I don't see a DoMenuitem in that code.
Is it in another procedure?
Are you able to use error handling in that procedure to handle the message?
 
S

Stephanie

Interesting! Turns out that I did have DoMenuItem in other
code onthat form (from adding buttons). Which leads to
FABULOUS news- my code was working! I just didn't know
it. However, your method for handling all of the messages
up front is much better so I'll use that- thanks for
sharing it. I got rid of all the DoMenuItem button code.
I picked up a form with nav buttons that works well off
the list.
Thanks for your patience- I appreciate it! Stephanie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Event Fires Twice 2
Data validation 2
Require fields and refresh 14
No current record error 0
Remove Identical words 0
Help With Code Please 5
Spell Check button issue with subform 2
dlookup compare date values 8

Top