By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,561 Members | 3,113 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,561 IT Pros & Developers. It's quick & easy.

The OpenForm action was cancelled. 2501

P: n/a
SDL
Help!

I have a system that was running fine and I was testing a bottom level
form. I went from a menu to a screen where I could enter a phone number
or name to find a customer. If the customer name hit on more than one
person ther is an interim selection screen. I have been running thru
these screens for 2 days now and everything was fine and suddenly I get
"The OpenForm actionwas cancelled." Run Time err 2501? This is
happening on several of my OpenForm commands!

stLinkCriteria = "CUSTOMER_ID = " & CUSTOMER_ID
stDocName = "NEW INVOICE"
DoCmd.OpenForm stDocName, , , stLinkCriteria

stDocName="NEW INVOICE"
stLinkCriteria="CUSTOMER_ID=6"

As I said suddenly several similar opens are getting that same error?

This is frustrating as hell as I'm fairly new to MS-Access VBA and have
a very tight deadline. So far I have found that writing screens 20
years ago on dumb terminals with a home grown database and home grown
'CICS' with Assembler code and 3270 control characters was about the
same LOL.

Jul 14 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Access is informing you that the form/report did not open, so the logic in
your code does not blithely proceed assuming that it is now open.

If you don't care, just trap Error 2501, and ignore it.

If error handling is a new concept, there's a skeleton outline in this
article
Error Handling in VBA
at:
http://allenbrowne.com/ser-23a.html
It also explains how to call a generic error handler that ignores the error,
and logs errors if you want that too.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"SDL" <SD********@gmail.comwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
Help!

I have a system that was running fine and I was testing a bottom level
form. I went from a menu to a screen where I could enter a phone number
or name to find a customer. If the customer name hit on more than one
person ther is an interim selection screen. I have been running thru
these screens for 2 days now and everything was fine and suddenly I get
"The OpenForm actionwas cancelled." Run Time err 2501? This is
happening on several of my OpenForm commands!

stLinkCriteria = "CUSTOMER_ID = " & CUSTOMER_ID
stDocName = "NEW INVOICE"
DoCmd.OpenForm stDocName, , , stLinkCriteria

stDocName="NEW INVOICE"
stLinkCriteria="CUSTOMER_ID=6"

As I said suddenly several similar opens are getting that same error?

This is frustrating as hell as I'm fairly new to MS-Access VBA and have
a very tight deadline. So far I have found that writing screens 20
years ago on dumb terminals with a home grown database and home grown
'CICS' with Assembler code and 3270 control characters was about the
same LOL.

Jul 14 '06 #2

P: n/a
SDL
I need the forms to open that is the problem. I execute the code and
get this message with no further explanation. I don't need to ignore
the error I need to fix it and get the forms to open.

Jul 14 '06 #3

P: n/a
Ah, good. You understand what the errror means.

First, we need to be sure that Access is not confused about the names of
things. Uncheck the boxes under:
Tools | Options | General | Name AutoCorrect

Then compact the database to get rid of this junk:
Tools | Database Utilities | Compact
Explanation of why:
http://allenbrowne.com/bug-03.html

After that, check there is no code in the Open event of the form that could
cancel it.

Does it happen if you open form without criteria, e.g.:
DoCmd.OpenForm "NEW INVOICE"

It that's fine, then it would seem that the WhereCondition string is
malformed. For example, if Customer_ID is a Text type field (not a Number
type in table design), you need extra quotes as described here:
http://allenbrowne.com/casu-17.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"SDL" <SD********@gmail.comwrote in message
news:11*********************@m79g2000cwm.googlegro ups.com...
>I need the forms to open that is the problem. I execute the code and
get this message with no further explanation. I don't need to ignore
the error I need to fix it and get the forms to open.

Jul 14 '06 #4

P: n/a
SDL
Allen thanks much I walked thru your suggestions just before coming
back here (found a bunch in an egghead forum which looks like the list
below. I tried those and then went into
http://allenbrowne.com/ser-47.html and it is up and running.

Thanks you are a life saver!

Sincerely,

Steve


Allen Browne wrote:
Ah, good. You understand what the errror means.

First, we need to be sure that Access is not confused about the names of
things. Uncheck the boxes under:
Tools | Options | General | Name AutoCorrect

Then compact the database to get rid of this junk:
Tools | Database Utilities | Compact
Explanation of why:
http://allenbrowne.com/bug-03.html

After that, check there is no code in the Open event of the form that could
cancel it.

Does it happen if you open form without criteria, e.g.:
DoCmd.OpenForm "NEW INVOICE"

It that's fine, then it would seem that the WhereCondition string is
malformed. For example, if Customer_ID is a Text type field (not a Number
type in table design), you need extra quotes as described here:
http://allenbrowne.com/casu-17.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"SDL" <SD********@gmail.comwrote in message
news:11*********************@m79g2000cwm.googlegro ups.com...
I need the forms to open that is the problem. I execute the code and
get this message with no further explanation. I don't need to ignore
the error I need to fix it and get the forms to open.
Jul 14 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.