[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 319
  • Last Modified:

getting rid of system notices

I can't get rid of the following notice:  
"The DoMenuItem action was canceled.  You used a method of the DoCmd object to carry out an action in Visual Basic, but then clicked Cancel in a dialog box..."

I've used the setwarnings command to turn off system messages, but it doesn't get rid of this particular one.

jptu
0
jptu
Asked:
jptu
1 Solution
 
brewdogCommented:
Is this on a form, I take it? What happens when you get this message? I usually get it when I send something to print and then cancel or when my code hits an error which causes Access to cancel something.

This isn't considered one of Access' system warnings -- it's an actual error (2501, I think). That means you'll have to trap it.
0
 
lmerrellCommented:
I've gotten this same message a couple of times when performing a TransferText on a locked text file.  The cause of the problem was a timed out FTP session which was used to transfer the text file from our mainframe.  I had to reboot to release the lock and the TransferText then worked fine.

lmerrell
0
 
wesleystewartCommented:
jptu:

I run into this all the time when using a command button to open a form that uses a parameter query as a datasource or has a construct similar to "[Enter Customer]" in the QBE grid as criteria.  If your command button opens the form, then the query will display an input box for the parameter.  If you then click cancel, the form can't open because the query can't run without parameters.

I believe the best solution is to use a form to gather input, process the input, and then open the form only when you've got good parameters from the user.

If this isn't the case, gleefully ignore my comment and let us know the exact conditions that give you the error message.

Wes
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
jptuAuthor Commented:
I don't think it is an error message, because my procedure doesn't jump to the error messge that I specify when this error occurs.  I get this error when I switch to another form.  However, before switching, it will ask if the user wants to save the form first.  If yes, then it goes to save the form, but it must pass some validation rules first.  If it doesn't pass, then the save is cancelled and the form is not switched.

jptu
0
 
jptuAuthor Commented:
wesleystewart- I was thinking of doing that too.  I will wait a bit more for additional comments before taking this approach.  Thanks.

jptu
0
 
BrianWrenCommented:
Set a flag to indicate where in the code you are, (I have a gloabl string 'wher' which I use as the WHERE part of domain aggregate functions, and as a 'flag' in error handlers to show where I am.)

Then in the error handler, ignore Err.Number 2501 if you are at the part of code that could have an 'object open' cancelled:

-------------------------------

   On Error goto ErrHndl

   wher = "Opening 1st form"
   DoCmd.OpenForm
   wher = ""
    .
    .
    .

SubExit:
   Exit Sub

ErrHndl:
   Select Case wher
      Case "Opening 1st form"
         If Err.Number = 2501 Then
            Resume Next
         End If
      Case "...."
   End Select

   ' If you get to here, the error
   ' isn't any of the things you've
   ' trapped for, so use your regular
   ' method of handling errors...
   MsgBox Err.Number & ", " & _
          Err.Description
   Resume SubExit

-------------------------------

It's true that the message you are getting is not a warning.  It also is not really an error, per se.  In many instances the 'error' functionality of Access is used as a notification system--a system which can assert itself strongly...  (It's more like a 'non-maskable interupt' in code.)
0
 
brewdogCommented:
glad you got an answer. Just curious (for me and others who might look at this later): what was the situation, and how did BrianWren's comment solve it?
0

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now