Link to home
Start Free TrialLog in
Avatar of wlwebb
wlwebbFlag for United States of America

asked on

Access - Run-time error 2501 RunCommand canceled.

Hello all

I have a tabbed form that when I Select a Location and then click a Command Button it is supposed to create a set number of records for input by the user.

If I F9 the first line of that Command Buttons code and F8 to step thru it it all works....

However if I get rid of the F9 on that first line and just let the code run it errors and gives me the
Run-Time error 2501
RunComman action was canceled...

I am attaching a generic version of the db so you can see it for yourself.....

The form to open is [tfrm_Reporting]

There is ONE highlighted combobox field to select a location name.  (there's only one)  select it and click the Command Button right beside it captioned "Create Input Form"

that is when it is to create the exact number of records I want input.
Test-Continuous-Cycle-Records.accdb
SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wlwebb

ASKER

Irog.......

Looking at the code I think you are doing what MBiz was suggesting...... Am I right in that?????  

As you and MBiz have helped a lot in the past you know I am very very limited in what I understand to this point.
Avatar of wlwebb

ASKER

Oh.... AND WOW is that a lot faster loading....!!!!!!
I need to correct myself.  It was someone else I advised about not using Lookup fields.  So in case no one has mentioned this yet, let me just paste a bit of what I posted in another question.

Lookup Fields --  why oh why did Microsoft add this feature!
I cannot emphasize enough the magnitude of avoiding using Lookup Fields in your table.  It's purpose was to make it supposedly easy for a novice to work with related tables.  However, it causes more problems than it solves and I think it actually makes it more confusing for those trying to grasp the concept of relational tables.  

Every newcomer to Access read and heed this article:
The Evils of Lookup Fields in Tables    Adding one more bullet to the list in this article is the inability of Child and Master fields to link properly if one of the fields is a Lookup field.
I saw Miriam's code after I posted but you're right about them being pretty much the same.  That's because great minds think alike :-)
Mine just has a nested loop so that it covers all 3 transaction types.
Avatar of wlwebb

ASKER

By lookup fields in my tables you are specifically referring to the Lookup tab on the table setup where my SELECT statement is correct???????????

And by the way................for You and for Mbiz........

I'm just now seeing what you guys meant by using the With statements a while back.......... I'm a might bit slow I guess.... Now this rst stuff............  whew ......... ;-))))
Avatar of wlwebb

ASKER

Is the DAO stuff that much faster than all this other code????
Avatar of wlwebb

ASKER

I split the points as both of you made the same suggestion but Irog actually put it in my db.....
I've never benchmarked it but I'm almost certain that looping through a Dao recordeset would be faster than the form based approach, which involves the bulk of the user interface.
You're right about the lookup tab in your table design.  Avoid that like the plague.  :-)