Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 22nd, 2007, 03:57 PM
Authorized User
 
Join Date: Apr 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default "The OpenForm command was canceled"

Run-time error no. 2501

I gather from searching this and other forums that this is often a difficult error to pin down but maybe someone can help. I am opening a new form from a subform. The following works ok but means opening the whole recordset and moving to the one I want:
DoCmd.OpenForm "frmClientPODetail", OpenArgs:=Me.PONo
What I really want to do this:
DoCmd.OpenForm "frmClientPODetail", WhereCondition:="PONo = " & Me.PONo
but this give the error above. Debugging shows that the error is generated in executing the OpenForm line itself, not in trying to open the new form.

Any suggestions?

Bob


 
Old April 23rd, 2007, 09:24 PM
Authorized User
 
Join Date: Jan 2006
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I suspect your PO Number is a text field so:
DoCmd.OpenForm "frmClientPODetail", WhereCondition:="PONo = '" & Me.PONo & "'"
...should work.


HTH RuralGuy (RG for short) acXP WinXP Pro
 
Old April 24th, 2007, 05:07 AM
Authorized User
 
Join Date: Apr 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks RG. Of course you're right, just because it's called a PO Number doesn't mean it really is a number!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Error 2001 You canceled the previous operation RayL Access VBA 3 December 8th, 2006 03:00 PM
The OpenForm action was canceled seananderson Access VBA 3 October 18th, 2006 12:34 PM
"you canceled the previous operation" error Totenkopf Access VBA 2 June 14th, 2006 02:48 PM
you canceled the previous operation lizhaskin Access 1 July 19th, 2005 12:36 PM
Error 2001: You canceled the previous operation RayL Access VBA 3 May 27th, 2005 07:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.