473,800 Members | 2,418 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trouble with OpenForm action was cancelled

13 New Member
Hello Again.

I'm so close I can TASTE IT! I'm working in Access 2003. I've read a bunch of posts, but still can't get to the bottom of this.

I have a "Selection Criteria" form (with Two free form Text Boxes Named Line_Num and Claim_Num).

Based on the entry in both fields, the users want to click on a button that launches and filters the returned results of the "Main form" by the Line and Claim numbers from the Selection Form. they want to be able to update data on the Main form when it launches.

I know the LinkCriteria is returning values (I put in a MsgBox at one point to see if that was the problem.. but it returned both values as part of the LinkCriteria string). I just keep getting "OpenForm action has been cancelled". I can't figure out what I'm doing wrong.

It works when I put the "DoCmd.OpenForm stDocName, , , stLinkCriteria" line in the Immediate window, so I know its something simple, but I just don't program enough to spot it.

The Main form has a recordsource of a query, the query references the Text Box input parameters (Text0 and Text2) from the "Selection Form"

I also tried using the main table (Drug_Util) as the "main form" record source. But got the same error.

ANY and all help is much appreciated.
Thank you so much, in Advance! :)

Expand|Select|Wrap|Line Numbers
  1. Private Sub CmdFormAdjustmentsForm_Click()
  2. On Error GoTo Err_CmdFormAdjustmentsForm_Click
  3.  
  4.     Dim stDocName As String
  5.     Dim stLinkCriteria As String
  6.  
  7.     stDocName = "F_ADJ"
  8.     stLinkCriteria = "[Line_Num]='" & Me![Text0] & "' AND [Claim_Num]='" & Me![Text2] & "'"
  9.  
  10.  
  11.     DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit
  12.     DoCmd.Close F_AdjSelect
  13.  
  14.  
Mar 25 '08 #1
3 2924
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit
  2. DoCmd.Close F_AdjSelect
  3.  
Hello again Ladybug76.
As it stands, it seems that the current DoCmd.Close is closing the form you have just opened. You appear to be missing an optional parameter in the DoCmd - the object type. I do not know what F_AdjSelect is - if it is meant to be the name of the current form it should have been placed in double quotes to treat it as a string literal.

If you want to close the current form you can refer to the form name using the Me.Name property of the form itself. If it is not the current form, supply the name of the actual form as a string literal or string variable. Both of these are shown below.

Expand|Select|Wrap|Line Numbers
  1. DoCmd.Close acForm, Me.Name
  2. DoCmd.Close acForm, "substitute the name of the form here"
  3. DoCmd.Close acForm, StrVariableValue
-Stewart
Mar 26 '08 #2
ladybug76
13 New Member
Hello Stewart.

Guess you drew the short straw (re: answering one of my posts) :)

F_ADJSelect is the Selection form the user keys their two parameters (Line and Claim number) into, then click the Command Button to launch the F_ADJ form. The F_ADJ form needs to be filtered on the Line and Claim numbers from the prior form. I had put the "Close" command on the F_ADJSelect so their weren't a bunch of forms open.

I tried commenting out the Close command, but I'm still receiving the same "OpenForm action was cancelled".

I did more research and apparently this is a MS Access Bug type thing. Unless you see anything else blatantly incorrect :D

Thanks for your response and help!! I do appreciate it.
~lb
Mar 26 '08 #3
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Guess you drew the short straw (re: answering one of my posts) :)
No, it's always a pleasure to assist you Ladybug!
...The F_ADJ form needs to be filtered on the Line and Claim numbers from the prior form.
Are these values actual numbers and not text? If they are, take out the single quotes on either side of the references to them in your strLinkCriteria statement - the single quotes apply to string literals only. The 'if they are numbers' version is shown below.
Expand|Select|Wrap|Line Numbers
  1. stLinkCriteria = "[Line_Num]=" & Me![Text0] & " AND [Claim_Num]=" & Me![Text2]
-Stewart
Mar 26 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
6879
by: Stuart Clark | last post by:
Hi, I have the following lines of code: stLinkCriteria = " BETWEEN " & & " AND " & DoCmd.OpenForm stDocName, , , stLinkCriteria Every time I try and run this I get the following error: Run-Time Error 2501 The OpenForm action was cancelled.
3
6215
by: Prakash Wadhwani | last post by:
In an openform event if I type cancel=true a msgbox pops up saying: "The OpenForm Acion was cancelled" This is iritating. Is there any way to turn of this message via VBA? Thx & Best Rgds, Prakash.
0
1420
by: Steve Hall | last post by:
Folks, I have an Access front end to a SQL Server 2k back end. The database consists of 5 main "record types" (many more tables than this however) - Test Logs (TLs), 2 Test Executions (TEs), 3 Test Reports (TRs), 4 Observation Reports (ORs), and 5 Change Reports (CRs). All TEs have a parent TL.
2
14111
by: John Phelan-Cummings | last post by:
After creating a button on a (parent) form linking to another (child) form, I received the following error when clicking on the command button: "The OpenForm action was canceled" No the child form is not a subform. I should also add that I created code in the properties window stating that the "child" "number" field on the form (that I was navigating to),
2
1819
by: jeffrod444 | last post by:
Hi, I've been having problems getting my forms to work correctly. If seen other threads addressing this issue, however, these are not working for me. The short of my problem is this. I am trying to open a new form and initialize it with a db query based on the info in the current form. This wasn't a problem until I changed the table's primary key to an Autonumber. tblLockCore.lockId is the autonumber at the source of the problem... ...
4
20880
by: SDL | last post by:
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...
4
1903
by: sid | last post by:
Can someone tell me how to detect "Action Cancelled" page with out polling. I have a frame set and I want to make sure the other frame is displaying what it is supposed to without polling. For some reason the page does not file OnError or OnLoad events. Any help is appreciated. Thanks
2
12876
by: mark mestrom | last post by:
hi, i have this problem with OpenForm and the stLinkCriteria. I have the following code: Private Sub Knop22_Click() On Error GoTo Err_Knop22_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "ALAHistorieEdit"
3
7495
by: victoria.rego | last post by:
Hi there, My application is generating a "The OpenForm action was cancelled" error and I can't seem to figure out why. The best part about it is that it's only one user in the entire building - it works perfectly fine for the rest of us. So troubleshooting is extremely difficult. Here is the code involved. The command button that opens the form, the code in the form, and the code in the subform of the form.
0
10505
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10275
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10253
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7576
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.