For example, one college course has only 24 students in it, but the
following code says there are zero As, 20 Bs, 16 Cs, 4 Ds, and 8 Fs. When
it prints it then says 0 As, 40 Bs, 32 Cs, 8 Ds, and 16 Fs. The actual
number it should show is zero As, 10 Bs, 8 Cs, 2 Ds, and 4 Fs. I can't find
anything wrong with the code. Here it is:
Option Compare Database
Option Explicit
'global variables
Dim numOfA As Integer
Dim numOfB As Integer
Dim numOfC As Integer
Dim numOfD As Integer
Dim numOfF As Integer
Private Sub Report_Open(Can cel As Integer)
numOfA = 0
numOfB = 0
numOfC = 0
numOfD = 0
numOfF = 0
End Sub
Private Sub GroupHeader1_Fo rmat(Cancel As Integer, FormatCount As Integer)
If txtAvg >= 0.92 Then
numOfA = numOfA + 1
End If
If txtAvg >= 0.82 And txtAvg < 0.92 Then
numOfB = numOfB + 1
End If
If txtAvg >= 0.72 And txtAvg < 0.82 Then
numOfC = numOfC + 1
End If
If txtAvg >= 0.62 And txtAvg < 0.72 Then
numOfD = numOfD + 1
End If
If txtAvg < 0.62 Then
numOfF = numOfF + 1
End If
End Sub
Private Function getAay() As Integer
getAay = numOfA
End Function
Private Function getBee() As Integer
getBee = numOfB
End Function
Private Function getCee() As Integer
getCee = numOfC
End Function
Private Function getDee() As Integer
getDee = numOfD
End Function
Private Function getEff() As Integer
getEff = numOfF
End Function 15 2003
Richard Hollenbeck <ri************ ****@verizon.ne t> wrote:
: For example, one college course has only 24 students in it, but the
: following code says there are zero As, 20 Bs, 16 Cs, 4 Ds, and 8 Fs.
: When it prints it then says 0 As, 40 Bs, 32 Cs, 8 Ds, and 16 Fs. The
: actual number it should show is zero As, 10 Bs, 8 Cs, 2 Ds, and 4 Fs.
: I can't find anything wrong with the code. Here it is:
:
: Option Compare Database
: Option Explicit
:
: 'global variables
: Dim numOfA As Integer
: Dim numOfB As Integer
: Dim numOfC As Integer
: Dim numOfD As Integer
: Dim numOfF As Integer
:
: Private Sub Report_Open(Can cel As Integer)
: numOfA = 0
: numOfB = 0
: numOfC = 0
: numOfD = 0
: numOfF = 0
: End Sub
:
: Private Sub GroupHeader1_Fo rmat(Cancel As Integer, FormatCount As
: Integer) If txtAvg >= 0.92 Then
: numOfA = numOfA + 1
: End If
:
: If txtAvg >= 0.82 And txtAvg < 0.92 Then
: numOfB = numOfB + 1
: End If
:
: If txtAvg >= 0.72 And txtAvg < 0.82 Then
: numOfC = numOfC + 1
: End If
:
: If txtAvg >= 0.62 And txtAvg < 0.72 Then
: numOfD = numOfD + 1
: End If
:
: If txtAvg < 0.62 Then
: numOfF = numOfF + 1
: End If
: End Sub
:
:
<snip>
So it's multiplying the correct answers by two? I wonder...how many
times does the format event fire for this header?
--
Please remove the under_scores if replying by mail.
Yes it's multiplying it by 2 initially, but then, when I print the report,
it multiplies by two again.
"Roald Oines" <r_*******@bres nan.net> wrote in message
news:Us******** ************@br esnan.com... Richard Hollenbeck <ri************ ****@verizon.ne t> wrote: : For example, one college course has only 24 students in it, but the : following code says there are zero As, 20 Bs, 16 Cs, 4 Ds, and 8 Fs. : When it prints it then says 0 As, 40 Bs, 32 Cs, 8 Ds, and 16 Fs. The : actual number it should show is zero As, 10 Bs, 8 Cs, 2 Ds, and 4 Fs. : I can't find anything wrong with the code. Here it is: : : Option Compare Database : Option Explicit : : 'global variables : Dim numOfA As Integer : Dim numOfB As Integer : Dim numOfC As Integer : Dim numOfD As Integer : Dim numOfF As Integer : : Private Sub Report_Open(Can cel As Integer) : numOfA = 0 : numOfB = 0 : numOfC = 0 : numOfD = 0 : numOfF = 0 : End Sub : : Private Sub GroupHeader1_Fo rmat(Cancel As Integer, FormatCount As : Integer) If txtAvg >= 0.92 Then : numOfA = numOfA + 1 : End If : : If txtAvg >= 0.82 And txtAvg < 0.92 Then : numOfB = numOfB + 1 : End If : : If txtAvg >= 0.72 And txtAvg < 0.82 Then : numOfC = numOfC + 1 : End If : : If txtAvg >= 0.62 And txtAvg < 0.72 Then : numOfD = numOfD + 1 : End If : : If txtAvg < 0.62 Then : numOfF = numOfF + 1 : End If : End Sub : : <snip>
So it's multiplying the correct answers by two? I wonder...how many times does the format event fire for this header?
-- Please remove the under_scores if replying by mail.
Richard Hollenbeck <ri************ ****@verizon.ne t> wrote:
: Yes it's multiplying it by 2 initially, but then, when I print the
: report, it multiplies by two again.
:
: "Roald Oines" <r_*******@bres nan.net> wrote in message
: news:Us******** ************@br esnan.com...
:: Richard Hollenbeck <ri************ ****@verizon.ne t> wrote:
::: For example, one college course has only 24 students in it, but the
::: following code says there are zero As, 20 Bs, 16 Cs, 4 Ds, and 8 Fs.
::: When it prints it then says 0 As, 40 Bs, 32 Cs, 8 Ds, and 16 Fs.
::: The actual number it should show is zero As, 10 Bs, 8 Cs, 2 Ds, and
::: 4 Fs. I can't find anything wrong with the code. Here it is:
:::
::: Option Compare Database
::: Option Explicit
:::
::: 'global variables
::: Dim numOfA As Integer
::: Dim numOfB As Integer
::: Dim numOfC As Integer
::: Dim numOfD As Integer
::: Dim numOfF As Integer
:::
::: Private Sub Report_Open(Can cel As Integer)
::: numOfA = 0
::: numOfB = 0
::: numOfC = 0
::: numOfD = 0
::: numOfF = 0
::: End Sub
:::
::: Private Sub GroupHeader1_Fo rmat(Cancel As Integer, FormatCount As
::: Integer) If txtAvg >= 0.92 Then
::: numOfA = numOfA + 1
::: End If
:::
::: If txtAvg >= 0.82 And txtAvg < 0.92 Then
::: numOfB = numOfB + 1
::: End If
:::
::: If txtAvg >= 0.72 And txtAvg < 0.82 Then
::: numOfC = numOfC + 1
::: End If
:::
::: If txtAvg >= 0.62 And txtAvg < 0.72 Then
::: numOfD = numOfD + 1
::: End If
:::
::: If txtAvg < 0.62 Then
::: numOfF = numOfF + 1
::: End If
::: End Sub
:::
:::
:: <snip>
::
:: So it's multiplying the correct answers by two? I wonder...how many
:: times does the format event fire for this header?
My point is that the format event can fire more than once if Access has
to return to previous sections for multiple formatting passes. This will
cause your counts to increment each time. You can use the Retreat event
to undo any changes you've done that you only want done once in the
section.
--
Please remove the under_scores if replying by mail.
Since the results are normally displayed on the second page, perhaps the
format event fires a second time before I even see the data then again at
print time. I wonder if there is another event I could put this subroutine
into that will only fire once--period.
By the way, the text boxes that display this data are set to private
functions. For example, the txtA box is set to =getAay(), and the txtB box
is set to =getBee(), etc.:
Private Function getAay() As Integer
getAay = numOfA
End Function
Private Function getBee() As Integer
getBee = numOfB
End Function
etc.
"Roald Oines" <r_*******@bres nan.net> wrote in message
news:Us******** ************@br esnan.com... Richard Hollenbeck <ri************ ****@verizon.ne t> wrote: : For example, one college course has only 24 students in it, but the : following code says there are zero As, 20 Bs, 16 Cs, 4 Ds, and 8 Fs. : When it prints it then says 0 As, 40 Bs, 32 Cs, 8 Ds, and 16 Fs. The : actual number it should show is zero As, 10 Bs, 8 Cs, 2 Ds, and 4 Fs. : I can't find anything wrong with the code. Here it is: : : Option Compare Database : Option Explicit : : 'global variables : Dim numOfA As Integer : Dim numOfB As Integer : Dim numOfC As Integer : Dim numOfD As Integer : Dim numOfF As Integer : : Private Sub Report_Open(Can cel As Integer) : numOfA = 0 : numOfB = 0 : numOfC = 0 : numOfD = 0 : numOfF = 0 : End Sub : : Private Sub GroupHeader1_Fo rmat(Cancel As Integer, FormatCount As : Integer) If txtAvg >= 0.92 Then : numOfA = numOfA + 1 : End If : : If txtAvg >= 0.82 And txtAvg < 0.92 Then : numOfB = numOfB + 1 : End If : : If txtAvg >= 0.72 And txtAvg < 0.82 Then : numOfC = numOfC + 1 : End If : : If txtAvg >= 0.62 And txtAvg < 0.72 Then : numOfD = numOfD + 1 : End If : : If txtAvg < 0.62 Then : numOfF = numOfF + 1 : End If : End Sub : : <snip>
So it's multiplying the correct answers by two? I wonder...how many times does the format event fire for this header?
-- Please remove the under_scores if replying by mail.
Roald Oines,
I think I understand what you mean. Thanks. I'll go back and study the
retreat event to see what I can do. Thanks a lot! I'm not sure how this
will work, but now I have something new to study. After I try it I'll get
back to the group.
Rich
"Roald Oines" <r_*******@bres nan.net> wrote in message
news:XJ******** ************@br esnan.com... Richard Hollenbeck <ri************ ****@verizon.ne t> wrote: : Yes it's multiplying it by 2 initially, but then, when I print the : report, it multiplies by two again. : : "Roald Oines" <r_*******@bres nan.net> wrote in message : news:Us******** ************@br esnan.com... :: Richard Hollenbeck <ri************ ****@verizon.ne t> wrote: ::: For example, one college course has only 24 students in it, but the ::: following code says there are zero As, 20 Bs, 16 Cs, 4 Ds, and 8 Fs. ::: When it prints it then says 0 As, 40 Bs, 32 Cs, 8 Ds, and 16 Fs. ::: The actual number it should show is zero As, 10 Bs, 8 Cs, 2 Ds, and ::: 4 Fs. I can't find anything wrong with the code. Here it is: ::: ::: Option Compare Database ::: Option Explicit ::: ::: 'global variables ::: Dim numOfA As Integer ::: Dim numOfB As Integer ::: Dim numOfC As Integer ::: Dim numOfD As Integer ::: Dim numOfF As Integer ::: ::: Private Sub Report_Open(Can cel As Integer) ::: numOfA = 0 ::: numOfB = 0 ::: numOfC = 0 ::: numOfD = 0 ::: numOfF = 0 ::: End Sub ::: ::: Private Sub GroupHeader1_Fo rmat(Cancel As Integer, FormatCount As ::: Integer) If txtAvg >= 0.92 Then ::: numOfA = numOfA + 1 ::: End If ::: ::: If txtAvg >= 0.82 And txtAvg < 0.92 Then ::: numOfB = numOfB + 1 ::: End If ::: ::: If txtAvg >= 0.72 And txtAvg < 0.82 Then ::: numOfC = numOfC + 1 ::: End If ::: ::: If txtAvg >= 0.62 And txtAvg < 0.72 Then ::: numOfD = numOfD + 1 ::: End If ::: ::: If txtAvg < 0.62 Then ::: numOfF = numOfF + 1 ::: End If ::: End Sub ::: ::: :: <snip> :: :: So it's multiplying the correct answers by two? I wonder...how many :: times does the format event fire for this header?
My point is that the format event can fire more than once if Access has to return to previous sections for multiple formatting passes. This will cause your counts to increment each time. You can use the Retreat event to undo any changes you've done that you only want done once in the section.
-- Please remove the under_scores if replying by mail.
"Roald Oines" <r_*******@bres nan.net> wrote in message
news:XJ******** ************@br esnan.com... Richard Hollenbeck <ri************ ****@verizon.ne t> wrote: : Yes it's multiplying it by 2 initially, but then, when I print the : report, it multiplies by two again. :
If you are using page numbering of the type "page n of m" then the entire
report is formatted twice: once to find out how many pages there are, and
then again with the correct page numbering.
I can't help feeling that this is not a smart way for you to proceed. If
you posted more information about what you are trying to achieve, someone
might have an alternative suggestion.
Is there a compelling reason *not* to put the (BETWEEN a AND b) =
<grade> in a query and then base your report on that?
Yes, the Format event is difficult to handle.
Make a query with all fields of your table and these more fields:
AA: iif(txtAvg >= 0.92 , 1, 0)
BB: iif(txtAvg >= 0.82 And txtAvg < 0.92 , 1, 0)
CC: iif(txtAvg >= 0.72 And txtAvg < 0.82 , 1, 0)
DD: iif(txtAvg >= 0.62 And txtAvg < 0.72 , 1, 0)
FF: iif(txtAvg < 0.62, 1, 0)
Put this query under your report then define the fields in the
Report_Footer as:
=SUM(AA)
=SUM(BB)
=SUM(CC)
=SUM(DD)
=SUM(FF)
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dariusz |
last post by:
I am a beginner in PHP and MySQL, and am working through a book and various
online tutorials on PHP and MySQL and now stuck - installed everything on
"localhost" and it all works fine. My question is as follows.
I have a guestbook type code I'm trying to write, but when the results get
printed to a webpage, it outputs completely nothing as what was entered in
the guestbook database. No errors appear to be generated, and I can't see
if...
|
by: Brandon |
last post by:
I am an amateur working on a first site, I have settled on using FP 2002 for
now. My current page is up and live, but I have two errors that I cant seem
to get rid of ...
Line 29, column 6: duplicate specification of attribute "STYLE"
style="border: 1px solid #00F;width: 750px; height: 690px;"
Line 154, column 46: there is no attribute "BORDERCOLOR"
<table border="0" cellspacing="0" bordercolor="#0000FF" width="650"
|
by: MattC |
last post by:
Hi,
I am developing a timesheet system that collects information about employees
activities. In this I collect details about projects they do work for, what
type of work, how long, when etc etc.
For distributed data input/storage and display I am happy using ASP.NET.
However ther eis one aspect of the project I am not entirely comfortable
with, report production. The requirement is to produce 6 or 7 reports that
view certain aspects...
|
by: Doug |
last post by:
I can't imagine this is that hard but I'm sure having a struggle
finding it. How do I convert a value like "111403" do a DateTime
variable in DotNet (i.e. 11/14/2003)?
|
by: W.Sh |
last post by:
Hello Everyone!
I'm having some issues with javascript that I can't seem to resolve...
Basically, I have a very simple code that's supposed to change the
innerHTML of a span element whenever I click on a checkbox. The
innerHTML reads "True" if the checkbox is checked, and "False" if the
checkbox is unchecked.
Now, the problem is that it only works when I check the checkbox, but
when I uncheck it nothing happens.
| |
by: rz2026 |
last post by:
Given a following table with two columns
date value
------------------------
01/01/2007 0
01/02/2007 1
01/05/2007 1
01/06/2007 1
01/07/2007 1
01/08/2007 -1
|
by: Villanmac |
last post by:
Ahhhh, ive missed so many lessons this year that i have to try and teach myself c++ from a book and its so hard. Usually I just read this forums to pick things up but its doing my head in trying to work it out, so I thought I would sign up and ask some people who know what they doing.
Basically im trying to write a program that reads in the radius of a circle and prints its radius, diameter,circumference and area. It dosent seem that hard but...
|
by: akirekab |
last post by:
I am tired, as I have done this or similar things many times, I am not seeing the problem here.
I will run a query producing the following SQL
SELECT tblInterviewRecord.FaceToFaceReasonID, tblInterviewRecord.InterviewtypeID, tblInterviewRecord.ContactDate, tblEmployees.Initials, tblInterviewRecord.ServiceTypeID, tblFaceToFaceReason.FaceToFaceReason
FROM tblEmployees INNER JOIN (tblInterviewRecord INNER JOIN tblFaceToFaceReason ON...
|
by: alex.j.k2 |
last post by:
Hello all,
I have "PRECISION" defined in the preprocessor code
and it could be int, float or double, but I do not know in the
code what it is.
Now if I want to assign zero to a "PRECISION" variable,
which of the following lines are correct:
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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...
| |
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...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |