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 DSum() not agree with the tabbed control?
I'm posting the code below.
Private Sub Form_Load()
ERROR STARTS HERE and continues to the next line if I remove the previous function.
DSumDay = DSum("[Day]", "StandsQ")
DSumNight = DSum("[Night]", "StandsQ")
DSumNVG = DSum("[NVG]", "StandsQ")
DSumHood = DSum("[Hood]", "StandsQ")
Text89 = DMax("[Date]", "StandsQ", "[STANDS Eval] = True")
Text90 = DMax("[Date]", "StandsQ", "[INST Eval] = True")
Text91 = DMax("[Date]", "StandsQ", "[NVG Eval] = True")
Text92 = DMax("[Date]", "StandsQ", "[NO NOTICE] = True")
Text93 = DMax("[Date]", "StandsQ", "[Table III/IV] = True")
Text94 = DMax("[Date]", "StandsQ", "[Table VII/VIII] = True")
Text95 = DMax("[Date]", "StandsQ", "[Table IX/X] = True")
SAEH = DMax("[Date]", "StandsQ", "[SAEH] = True")
FADEC = DMax("[Date]", "StandsQ", "[FADEC] = True")
CBAT = DMax("[Date]", "StandsQ", "[CBAT] = True")
CBRN = DMax("[Date]", "StandsQ", "[CBRN] = True")
[Last NVG] = DMax("[Date]", "StandsQ", "[NVG] > 0")
[Last Flt] = DMax("[Date]", "StandsQ")
Total = DSumDay + DSumNight + DSumNVG + DSumHood
[NVG Time] = DSumNVG
[PC Time] = DSum("[Day] + [Night] + [NVG] + [Hood]", "StandsQ", "[PC] = True")
End Sub
7 1642
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 DSum() not agree with the tabbed control?
I'm posting the code below.
Private Sub Form_Load()
ERROR STARTS HERE and continues to the next line if I remove the previous function.
DSumDay = DSum("[Day]", "StandsQ")
DSumNight = DSum("[Night]", "StandsQ")
DSumNVG = DSum("[NVG]", "StandsQ")
DSumHood = DSum("[Hood]", "StandsQ")
Text89 = DMax("[Date]", "StandsQ", "[STANDS Eval] = True")
Text90 = DMax("[Date]", "StandsQ", "[INST Eval] = True")
Text91 = DMax("[Date]", "StandsQ", "[NVG Eval] = True")
Text92 = DMax("[Date]", "StandsQ", "[NO NOTICE] = True")
Text93 = DMax("[Date]", "StandsQ", "[Table III/IV] = True")
Text94 = DMax("[Date]", "StandsQ", "[Table VII/VIII] = True")
Text95 = DMax("[Date]", "StandsQ", "[Table IX/X] = True")
SAEH = DMax("[Date]", "StandsQ", "[SAEH] = True")
FADEC = DMax("[Date]", "StandsQ", "[FADEC] = True")
CBAT = DMax("[Date]", "StandsQ", "[CBAT] = True")
CBRN = DMax("[Date]", "StandsQ", "[CBRN] = True")
[Last NVG] = DMax("[Date]", "StandsQ", "[NVG] > 0")
[Last Flt] = DMax("[Date]", "StandsQ")
Total = DSumDay + DSumNight + DSumNVG + DSumHood
[NVG Time] = DSumNVG
[PC Time] = DSum("[Day] + [Night] + [NVG] + [Hood]", "StandsQ", "[PC] = True")
End Sub
Day and Date are reserved words in ms access, and should not be used as field names. Try changing the names to something like MyDay and MyDate and see if that helps
Also, what is this? This is not proper syntax for the DSum function
Total = DSumDay + DSumNight + DSumNVG + DSumHood
[NVG Time] = DSumNVG
[PC Time] = DSum("[Day] + [Night] + [NVG] + [Hood]", "StandsQ", "[PC] = True")
I cleaned up the Syntax a bit to try and fix the Day and Date issues and to eliminate comfusion.
I'm still getting the error when I try and open the form that has this form nested as a subform in a tab control.
I'm still not getting an error and everything works fine when I open the form directly. Here's the new code.
Private Sub Form_Load()
Dim DaySum As Integer
DaySum = DSum("[DayTime]", "StandsQ")
Dim NightSum As Integer
NightSum = DSum("[Night]", "StandsQ")
Dim NVGSum As Integer
NVGSum = DSum("[NVG]", "StandsQ")
Dim HoodSum As Integer
HoodSum = DSum("[Hood]", "StandsQ")
Stands = DMax("[FltDate]", "StandsQ", "[STANDS Eval] = True")
Inst = DMax("[FltDate]", "StandsQ", "[INST Eval] = True")
NVGEval = DMax("[FltDate]", "StandsQ", "[NVG Eval] = True")
NoNotice = DMax("[FltDate]", "StandsQ", "[NO NOTICE] = True")
TableIII = DMax("[FltDate]", "StandsQ", "[Table III/IV] = True")
TableVII = DMax("[FltDate]", "StandsQ", "[Table VII/VIII] = True")
TableIX = DMax("[FltDate]", "StandsQ", "[Table IX/X] = True")
SAEH = DMax("[FltDate]", "StandsQ", "[SAEH] = True")
FADEC = DMax("[FltDate]", "StandsQ", "[FADEC] = True")
CBAT = DMax("[FltDate]", "StandsQ", "[CBAT] = True")
CBRN = DMax("[FltDate]", "StandsQ", "[CBRN] = True")
[Last NVG] = DMax("[FltDate]", "StandsQ", "[NVG] > 0")
[Last Flt] = DMax("[FltDate]", "StandsQ")
Total = DaySum + NightSum + NVGSum + HoodSum
[NVG Time] = NVGSum
[PC Time] = DSum("[DayTime] + [Night] + [NVG] + [Hood]", "StandsQ", "[PC] = True")
End Sub
I cleaned up the Syntax a bit to try and fix the Day and Date issues and to eliminate comfusion.
I'm still getting the error when I try and open the form that has this form nested as a subform in a tab control.
I'm still not getting an error and everything works fine when I open the form directly. Here's the new code. -
Private Sub Form_Load()
-
-
Dim DaySum As Integer
-
DaySum = DSum("[DayTime]", "StandsQ")
-
Dim NightSum As Integer
-
NightSum = DSum("[Night]", "StandsQ")
-
Dim NVGSum As Integer
-
NVGSum = DSum("[NVG]", "StandsQ")
-
Dim HoodSum As Integer
-
HoodSum = DSum("[Hood]", "StandsQ")
-
-
Stands = DMax("[FltDate]", "StandsQ", "[STANDS Eval] = True")
-
Inst = DMax("[FltDate]", "StandsQ", "[INST Eval] = True")
-
NVGEval = DMax("[FltDate]", "StandsQ", "[NVG Eval] = True")
-
NoNotice = DMax("[FltDate]", "StandsQ", "[NO NOTICE] = True")
-
TableIII = DMax("[FltDate]", "StandsQ", "[Table III/IV] = True")
-
TableVII = DMax("[FltDate]", "StandsQ", "[Table VII/VIII] = True")
-
TableIX = DMax("[FltDate]", "StandsQ", "[Table IX/X] = True")
-
SAEH = DMax("[FltDate]", "StandsQ", "[SAEH] = True")
-
FADEC = DMax("[FltDate]", "StandsQ", "[FADEC] = True")
-
CBAT = DMax("[FltDate]", "StandsQ", "[CBAT] = True")
-
CBRN = DMax("[FltDate]", "StandsQ", "[CBRN] = True")
-
[Last NVG] = DMax("[FltDate]", "StandsQ", "[NVG] > 0")
-
[Last Flt] = DMax("[FltDate]", "StandsQ")
-
Total = DaySum + NightSum + NVGSum + HoodSum
-
[NVG Time] = NVGSum
-
[PC Time] = DSum("[DayTime] + [Night] + [NVG] + [Hood]", "StandsQ", "[PC] = True")
-
-
End Sub
Your code looks much better.
Does your error occur whenever you click the tab control or does it occur just in the form load event without clicking the tab control? Have you set the master/child links between your main form and your subform?
The error occurs when the main form loads. I don't think it has anything to do with the tabbed control, because I created a new form to troubleshoot and added a subform with this form as its object source(no tabbed control).
I got the same error when I tried to open the new main form
Should there be any reason to use master/child linking between the main and subforms if I nothing but the subform on the main form?
The error occurs when the main form loads. I don't think it has anything to do with the tabbed control, because I created a new form to troubleshoot and added a subform with this form as its object source(no tabbed control).
I got the same error when I tried to open the new main form
Should there be any reason to use master/child linking between the main and subforms if I nothing but the subform on the main form?
jmoudy,
Yes, there is. The master/child links (or code equivalent) are needed in order for the form/subform to work together in an organized fashion, If you have no controls on the main form, you can use the hidden textbox trick.
1. Place an unbound textbox named (for example) txtMasterLink on your main form. Set its control source to:= Forms!YourMain!YourSubformControl.Form!YourChildLi nkField.(the field that drives your subform)
2. Go to subform control on the border between the main form and the subform, invoke the property sheet, and put the following for master and child links.
Master Link: txtMasterLink
Child Link: the bound linkfield on your subform that corresponds to the master link
3. Test and see if it works. If it works ok, then you can set the visible property of txtMasterLink to False to hide it.
I recoded the form to pull info from the table rather than a query, that seemed to fix that problem.
The only issue I'm having with it now is that it won't allow me to navigate between records. It pulls the first record and then shows an empty record when next or prev record is selected.
BTW, I really appreciate the help.
Private Sub Form_Load()
[Stands] = DMax("[FltDate]", "Flight Data", "[STANDS Eval] = True And [FltName] = '" & Forms![AV2]![AVSTATS2].Form![Name1] & "'")
[Inst] = DMax("[FltDate]", "Flight Data", "[INST Eval] = True And [FltName] = '" & Forms![AV2]![AVSTATS2].Form![Name1] & "'")
[NVGEval] = DMax("[FltDate]", "Flight Data", "[NVG Eval] = True And [FltName] = '" & Forms![AV2]![AVSTATS2].Form![Name1] & "'")
[NoNotice] = DMax("[FltDate]", "Flight Data", "[NO NOTICE] = True And [FltName] = '" & Forms![AV2]![AVSTATS2].Form![Name1] & "'")
[TableIII] = DMax("[FltDate]", "Flight Data", "[Table III/IV] = True And [FltName] = '" & Forms![AV2]![AVSTATS2].Form![Name1] & "'")
[TableVII] = DMax("[FltDate]", "Flight Data", "[Table VII/VIII] = True And [FltName] = '" & Forms![AV2]![AVSTATS2].Form![Name1] & "'")
[TableIX] = DMax("[FltDate]", "Flight Data", "[Table IX/X] = True And [FltName] = '" & Forms![AV2]![AVSTATS2].Form![Name1] & "'")
[SAEH] = DMax("[FltDate]", "Flight Data", "[SAEH] = True And [FltName] = '" & Forms![AV2]![AVSTATS2].Form![Name1] & "'")
[FADEC] = DMax("[FltDate]", "Flight Data", "[FADEC] = True And [FltName] = '" & Forms![AV2]![AVSTATS2].Form![Name1] & "'")
[CBRN] = DMax("[FltDate]", "Flight Data", "[CBRN] = True And [FltName] = '" & Forms![AV2]![AVSTATS2].Form![Name1] & "'")
[Last NVG] = DMax("[FltDate]", "Flight Data", "[NVG] > 0 And [FltName] = '" & Forms![AV2]![AVSTATS2].Form![Name1] & "'")
[Last Flt] = DMax("[FltDate]", "Flight Data", "[FltName] = '" & Forms![AV2]![AVSTATS2].Form![Name1] & "'")
[Total] = DSum("[DayTime] + [Night] + [NVG] + [Hood]", "Flight Data", "[FltName] = '" & Forms![AV2]![AVSTATS2].Form![Name1] & "'")
[NVG Time] = DSum("[DayTime] + [Night] + [NVG] + [Hood]", "Flight Data", "[NVG] = True And [FltName] = '" & Forms![AV2]![AVSTATS2].Form![Name1] & "'")
[PC Time] = DSum("[DayTime] + [Night] + [NVG] + [Hood]", "Flight Data", "[PC] = True And [FltName] = '" & Forms![AV2]![AVSTATS2].Form![Name1] & "'")
End Sub
I recoded the form to pull info from the table rather than a query, that seemed to fix that problem.
The only issue I'm having with it now is that it won't allow me to navigate between records. It pulls the first record and then shows an empty record when next or prev record is selected.
BTW, I really appreciate the help.
Check your form properties. Should be as follows:
allow additons = yes
allow edits = yes
data entry = no
Sign in to post your reply or Sign up for a free account.
Similar topics
by: deko |
last post by:
RE: "Object Invalid or No Longer Set" errors
I've had an angelic visitation and the revelation is that my problem, in
essence, is due to the fact that I have multiple forms open at the same time...
|
by: swathky |
last post by:
I've tried mutiple things but no go -- (sorry this is so long)
I'm collecting a 5 digit number in an input box function and all works
fine until a number is passed that doesn't exist in the...
|
by: Peter Frost |
last post by:
Please help
I don't know if this is possible but what I would really like to do is
to use On Error Goto to capture the code that is being executed when
an error occurs.
Any help would be much...
|
by: John A. |
last post by:
This is a database in use on Terminal server, been reliable, no corruption
problems. (so far)
Designing a form, asked to save objects, Access put up a dialog box for the
current form asking me...
|
by: Jorgen Haukland, Norway |
last post by:
Hi,
I have created a Java webservice which runs in IBM WebSphere appserver. I
take the WSDL-file and create a VS.NET WinForm application and calls the
service running on my PC and everything...
|
by: Kirk |
last post by:
I'm trying to use a Web Service to be a Remoting client of an existing
..NET 2.0 server. But I get the following error when I try to use
System.Runtime.Remoting.Channels.Http in my WebService. ...
|
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...
|
by: Jim Armstrong |
last post by:
Hello all -
This is driving me crazy. I have a table called tblClients - very
simple, has the following fields:
taxID (PK)
ClientName
SalesName
The main form of my application allows a...
|
by: AccessBeetle |
last post by:
I am creating simple login form with linked tables(atual tables are in SQL 2005) in access 2003.
Here is my code.
Option Compare Database
Private Sub cmdSignIn_Click()
'Check to see if data...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
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...
|
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...
| |