473,394 Members | 1,965 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.

subtotal on form footer

Hi,

I have a continuous form with three fields: id, date, score. I am
trying to add total field on the form footer to show total score for
certain year.

I created a unbound textbox and set the control source as:
=sum(iif(year(date)=2007,nz(score),0))

It work, and give me the subtotal for 2007. Now I want to add another
unbound textbox(text1) on the footer so that people can input the
year, and I change the control source to
=sum(iif(year(date)=[text1],nz(score),0))

It shows #error
I also tried [forms].[myformname].[text1] instead of [text1], same
error. Can anyone help me out?

Thank you

Evan
Jan 25 '08 #1
4 6063
Try

=sum(iif(CStr(year(date))=2007,nz(score),0))

Convert the year to a string so that the compare will work

Phil

"Evan" <ev****@gmail.comwrote in message
news:e6**********************************@k39g2000 hsf.googlegroups.com...
Hi,

I have a continuous form with three fields: id, date, score. I am
trying to add total field on the form footer to show total score for
certain year.

I created a unbound textbox and set the control source as:
=sum(iif(year(date)=2007,nz(score),0))

It work, and give me the subtotal for 2007. Now I want to add another
unbound textbox(text1) on the footer so that people can input the
year, and I change the control source to
=sum(iif(year(date)=[text1],nz(score),0))

It shows #error
I also tried [forms].[myformname].[text1] instead of [text1], same
error. Can anyone help me out?

Thank you

Evan

Jan 25 '08 #2
Thank you Phil,

If I want 2007 only, that work. My challenge is I need to include a
textbox in the formula so that people can input any year.

Evan
Jan 26 '08 #3
You need a TextBox called "InputDate" in the header of your continuous form.
I leave it to you to work out routines that are going to result in a 4 digit
year (prpbably not in the future and not before a certain date with only
numbers.

Then your clause becomes

Sum(IIf(CStr(year(date))=Forms!MyFormName!InputDat e,Nz(score),0))

Incidently it is bad practice to call a field "Date" it is a reserved word.
OK if you always put square brackets [] round it. Much better to call it
somethin like MatchDate

Phil
"Evan" <ev****@gmail.comwrote in message
news:75**********************************@c23g2000 hsa.googlegroups.com...
Thank you Phil,

If I want 2007 only, that work. My challenge is I need to include a
textbox in the formula so that people can input any year.

Evan

Jan 26 '08 #4
You are right, name a field "date" is very bad idea.
I tried the clause you wrote. Same error. If I replace the Forms!
MyFormName!InputDate with a real number, say 2007, it works.
Thank you for being patient

Jan 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Charlene | last post by:
I have an Invoice/Invoice Details form/subform. In the page footer of the Invoice Details subform I have a textbox with the control source set to =Sum(). I then pull this value into the main form...
2
by: John Baker | last post by:
Hi: I am developing a report, and have run into a reference snag. I have subtotals which i generate on the report, and have named "tasksum", which represent the number of hours an individual...
3
by: ChadDiesel | last post by:
I'm new to Access and need some advice. I am trying to setup a database to print labels and reports for our shipments. I have set up a table with fields such as I have taken a snapshot of what...
1
by: ChadDiesel | last post by:
I'm new to access and need some help. I have a form with a shipment destination at the top. I then have a subform that I enter boxes for that shipment. I have several shipments going at a...
2
by: Sparky Arbuckle | last post by:
Hello All! My problem is trying to calculate SubTotal in my FOR EACH NEXT Loop. I am looping through depending on how many of each different item is in the user's shopping cart. I am using each...
3
by: xian2 | last post by:
Hi All, I am trying to create a subtotal text box much like the one in the orders form of the northwind database where you have a subtotal text box in the footer of the subform and then have that...
1
by: Ken | last post by:
hi. I need to add subtotal of some columns on the bottom (footer ?) of Gridview? is it possible? then how? Thanks
2
by: murch.alexander | last post by:
Hi all, I have a query that uses a subquery to subtotal one of its fields. This part is working fine. The twist is that when I encounter certain values, I want to reset the subtotal to zero and...
12
by: etmanage | last post by:
I have a subform that totals a subtotal in the form footer. It works fine. I then pull that value onto the main form into a textbox called Subtotal2 by setting the control source...
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: 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...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.