473,394 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Error: You cancelled the previous operation

111 100+
Some of this may look familar to some of you, as part of it was posted previously. As i got farther along, i realized i was missing part of it and had to go back and redesign. The code is not fully complete so i just commented the lines that are not relevent to the issue. When the code is run, i'm getting an error that says "You cancelled the previous operation". First i was getting an error of "invalid use of null" and added the Nz functions in, leaving me with the error im at now. Can someone please help?

Expand|Select|Wrap|Line Numbers
  1. Private Sub btnCabin_Click()
  2. On Error GoTo Err_btnCabin_Click
  3.  
  4.     Dim stDocName As String
  5.     Dim stLinkCriteria As String
  6.  
  7.     Dim intInside As Integer
  8.     Dim intInside2 As Integer
  9.     Dim intInside3  As Integer
  10.     Dim intInside4  As Integer
  11.  
  12.     'Dim intOV As Integer
  13.     'Dim intBalc As Integer
  14.     Dim SQL As String
  15.     Dim strInsideCatA As String
  16.     Dim strInsideCatB As String
  17.     Dim strInsideCatC As String
  18.     Dim strInsideCatD As String
  19.  
  20.     stDocName = "frmNewCabins"
  21.  
  22.     stLinkCriteria = "[GroupNumber]=" & "'" & Me![GroupNumber] & "'"
  23.     DoCmd.OpenForm stDocName, , , stLinkCriteria
  24.  
  25.     strInsideCatA = Nz([Forms]![frmNewCabins]![InsideCat], "")
  26.     strInsideCatB = Nz([Forms]![frmNewCabins]![InsideCatB], "")
  27.     strInsideCatC = Nz([Forms]![frmNewCabins]![InsideCatC], "")
  28.     strInsideCatD = Nz([Forms]![frmNewCabins]![InsideCatD], "")
  29.  
  30.     intInside = DCount("tblManifest.[ID]", "tblManifest", "tblManifest.[Category] = 'Inside' AND tblManifest.[CategoryNum] = strInsideCatA AND [GroupNumber]=" & "'" & Me![GroupNumber] & "'")
  31.     intInside2 = DCount("tblManifest.[ID]", "tblManifest", "tblManifest.[Category] = 'Inside' AND tblManifest.[CategoryNum] = strInsideCatB AND [GroupNumber]=" & "'" & Me![GroupNumber] & "'")
  32.     intInside3 = DCount("tblManifest.[ID]", "tblManifest", "tblManifest.[Category] = 'Inside' AND tblManifest.[CategoryNum] = strInsideCatC AND [GroupNumber]=" & "'" & Me![GroupNumber] & "'")
  33.     intInside4 = DCount("tblManifest.[ID]", "tblManifest", "tblManifest.[Category] = 'Inside' AND tblManifest.[CategoryNum] = strInsideCatD AND [GroupNumber]=" & "'" & Me![GroupNumber] & "'")
  34.  
  35.  
  36.  
  37.     'intOV = DCount("tblManifest.[ID]", "tblManifest", "tblManifest.[Category] = 'OV' AND [GroupNumber]=" & "'" & Me![GroupNumber] & "'")
  38.     'intBalc = DCount("tblManifest.[ID]", "tblManifest", "tblManifest.[Category] = 'Balcony' AND [GroupNumber]=" & "'" & Me![GroupNumber] & "'")
  39.  
  40.     Forms![frmNewCabins]![InsideRemain] = Forms![frmNewCabins]![InsideAmt] - intInside
  41.     Forms![frmNewCabins]![InsideRemainB] = Forms![frmNewCabins]![InsideAmtB] - intInside2
  42.     Forms![frmNewCabins]![InsideRemainC] = Forms![frmNewCabins]![InsideAmtC] - intInside3
  43.     Forms![frmNewCabins]![InsideRemainD] = Forms![frmNewCabins]![InsideAmtD] - intInside4
  44.  
  45.  
  46.     'Forms![frmNewCabins]![OVRemain] = Forms![frmNewCabins]![OVAmt] - intOV
  47.     'Forms![frmNewCabins]![BalconyRemain] = Forms![frmNewCabins]![BalconyAmt] - intBalc
  48.  
  49.  
  50. Exit_btnCabin_Click:
  51.     Exit Sub
  52.  
  53. Err_btnCabin_Click:
  54.     MsgBox Err.Description
  55.     Resume Exit_btnCabin_Click
  56.  
  57. End Sub
Sep 13 '07 #1
7 1429
Neekos
111 100+
ok i've narrowed it down and realized its my syntax. Can someone help me with the correct syntax for this part of my code:

Expand|Select|Wrap|Line Numbers
  1. intInside = DCount("tblManifest.[ID]", "tblManifest", "tblManifest.[Category] = 'Inside' AND tblManifest.[CategoryNum] = strInsideCatA  AND [GroupNumber]=" & "'" & Me![GroupNumber] & "'")
i know that's the part thats giving me my error, but i dont know the correct syntax.

Thanks!
Sep 13 '07 #2
try
intInside = DCount("tblManifest.[ID]", "tblManifest", "tblManifest.[Category] = 'Inside' AND tblManifest.[CategoryNum] = strInsideCatA AND [GroupNumber]= Me![GroupNumber] ")
or
intInside = DCount("tblManifest.[ID]", "tblManifest", "tblManifest.[Category] = "& 'Inside' AND tblManifest.[CategoryNum] = strInsideCatA AND [GroupNumber]= Me![GroupNumber])

This is the syntax for numaric values but not sure if it will work with what your doing here. worth a shot though
Sep 13 '07 #3
Neekos
111 100+
the code worked fine until i added the part that i bolded above - thats the part that needs the syntax corrected.
Sep 13 '07 #4
mlcampeau
296 Expert 100+
the code worked fine until i added the part that i bolded above - thats the part that needs the syntax corrected.
Not sure how to refer to the strInsideCatA variable, but what if you were to try replacing it with the expression you have assigned to it: Nz([Forms]![frmNewCabins]![InsideCat], "")?
Sep 13 '07 #5
Neekos
111 100+
This gives me a syntax error:

Expand|Select|Wrap|Line Numbers
  1. intInside = DCount("tblManifest.[ID]", "tblManifest", "tblManifest.[Category] = 'Inside' AND tblManifest.[CategoryNum] = Nz([Forms]![frmNewCabins]![InsideCat], "") AND [GroupNumber]=" & "'" & Me![GroupNumber] & "'")
Sep 13 '07 #6
Neekos
111 100+
Ok i figured it out, but im not really sure why....i just kind of mimicked the same syntax for the third part of the AND statement where GroupNumber is.

this is what i have that works:

Expand|Select|Wrap|Line Numbers
  1. intInside = DCount("tblManifest.[ID]", "tblManifest", "tblManifest.[Category] = 'Inside' AND tblManifest.[CategoryNum] =" & "'" & Nz([Forms]![frmNewCabins]![InsideCat], "") & "' AND [GroupNumber]=" & "'" & Me![GroupNumber] & "'")
Sep 13 '07 #7
mlcampeau
296 Expert 100+
Ok i figured it out, but im not really sure why....i just kind of mimicked the same syntax for the third part of the AND statement where GroupNumber is.

this is what i have that works:

Expand|Select|Wrap|Line Numbers
  1. intInside = DCount("tblManifest.[ID]", "tblManifest", "tblManifest.[Category] = 'Inside' AND tblManifest.[CategoryNum] =" & "'" & Nz([Forms]![frmNewCabins]![InsideCat], "") & "' AND [GroupNumber]=" & "'" & Me![GroupNumber] & "'")
The quotes can be quite confusing, but I'm glad you got it working.
Sep 13 '07 #8

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

Similar topics

1
by: daniel kern | last post by:
Please help with the following issue. I am trying to dump a table. My mysqldump command is: mysqldump.exe -u xx -P xx --add-drop-table --quick --extended-insert --result-file=xx "--where=cdrdate...
0
by: Jeff Pritchard | last post by:
Has anybody had a problem with the SaveAsText function causing an error 'you cancelled the previous operation'. I have some code that was previously working fine, but now is giving this error. I am...
2
by: Richard Hollenbeck | last post by:
I got this: "Error 2001 You cancelled the previous operation" with this: Private Sub courseCode_GotFocus() Dim myDLookupResults As String myDLookupResults = DLookup("courseID", "courses",...
2
by: John A. | last post by:
I've received this error several times, and have only been able to get around it by deleting the offending form(s) and importing them from backup - Here's the sequence: 1. I'm editing a form or...
2
by: tara99 | last post by:
I am trying to update a table. It works but at the end the system displays the following Message "Previous operation cancelled" Does any one know what does this means. Thanks
6
by: Widge | last post by:
I've been using code similar to this: Option Compare Database Private Sub Form_Open(Cancel As Integer) SetFilter
1
by: noneedforthis | last post by:
I'm a new user of Access/VB and ran in to this nasty wall. (Access 2003, VB6.3, Windows XP) Runtime Error 2001: You cancelled the previous operation. The highlighted line is the one where the...
2
by: Asle | last post by:
Hi, I have a form called Customer and another form called Loan.. the Loan Details has to be entered every month until it is closed. I have designed a form such that, the user goes to the...
1
by: paulw4 | last post by:
I have the code below to run a query, that is created from a "fill in the blanks" form. I am now getting the error "You cancelled the previous operation" Earlier when I got this I closed the...
7
jmoudy77
by: jmoudy77 | last post by:
I've got some vb code that gives me a "previous operation cancelled" error when I try and open the form as a subform in a tabbed control. When I open the form itself I don't get the error. Does...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.