473,756 Members | 2,703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access Project (adp) - Filter form and sub totals

6 New Member
Hello,

I'm using a Microsft Access 2000 Project (adp file) connected to MS SQL Server 2000 database.

I have created a continous form having a detail part (results of the query) and a footer part (aggregate functions).

My problem concerns the sub-totals calculated in the footer part that are not updated when the results are filtered in the form.

For exemple, if we have the following results

ID City Country Population
1 Paris France 2.100.000
2 New-York USA 8.100.000
3 Marseille France 800.000

The sub-total calculated is 11.000.000 which is correct.

However, when I filter the results in the form to the country "France" (right filter by selection), the sub-total calculated is still 11.000.000 which is wrong. :confused:

Anyone have the same problem ?

Anyone having an idea ?

I have tested this functionnality with a Access database (.mdb file) and the sub-total is correctly updated when the results are filtered. :eek:

Why a different behavior between an "adp" and a "mdb" file ?

Anyone having an idea to get the correct sub-totals with filtered results ?

Thank you for your help.

Terrybens
Jul 17 '06 #1
13 11270
comteck
179 New Member
How are you calculating the result?

comteck
Jul 17 '06 #2
terrybens
6 New Member
=Sum([Database_field])

Terrybens
Jul 18 '06 #3
terrybens
6 New Member
I thought about adding VBA on the filter event to recalculate the totals but this seems to be quite difficult. There should be another solution because there is no problem with an mdb file.

All my queries are in proc stocks so I cannot use an mdb file.

Terrybens.
Jul 19 '06 #4
davenims
1 New Member
Hi Terry

Perhaps you've solved this by now, but if not, the issue is with the way an ADP fetches the data from the server. The normal .Filter propery fetches the data and then applies a filter to it to choose which records to display. It seems that the totals on the form are calculated before this process on an ADP, which is what causes this problem.

The solution is actually dead simple:

Rather than using:
Form.Filter = "Your Filter"

You need to use:
Form.ServerFilt er = "Your Filter"
Form.Requery (If the filter is being applied in VBA you'll need one of these)

The ServerFilter property for the form is right down at the bottom of the property list.

Using this method the filter is applied at the server end before the data is fetched, so not only will your totals now be correct, but the query will run more quickly aswell.

Hope this helps
Aug 4 '06 #5
terrybens
6 New Member
Hi,

Thanx a lot Dave for your help.

However in my case the problem remains. I use a proc stock to get my data and a server filter cannot be applied to a proc stock :confused: .

My totals then remain wrong :( .

I need a proc stock to get my data.

Any other idea ? I thought about temporary tables but this is quite to complicated.

Thank you guys for your help.

Terry
Aug 25 '06 #6
comteck
179 New Member
Terry,

Try doing your filtering in a query. Then do the calculation in the query itself as an expression.

The SQL statement would be sort of like this:

SELECT Sum([Population]) AS ExpressionName
FROM tblTableName
WHERE (((tblTableName .Country)="Fran ce"));

If you don't know SQL very well, that is ok. Just go into query design view, switch over to SQL view from the view icon in the upper left corner, and enter the code above (replace fieldname and tblTableName with your appropriate names - same for Population and Country. Replace these with whatever you named your table/fields). Also, use whatever ExpressionName that you like - It doesn't make any difference.

When you've entered the SQL, switch back over to design view, and the word "France" will be in the criteria box under Country. If you want to be prompted for a country instead, replace the word "France" with the following:

[Enter Country Name]

Try running the query by itself before assigning it to a form, to see if it works ok.

Hope this helps.
comteck
Aug 25 '06 #7
terrybens
6 New Member
Thank you comteck for your reply.

I cannot use "sum" in the source of my form because the form displays a list of results while a "sum" function in a query will return an aggregated line.

I can however calculate the sub-total in another query using VBA code, which is your solution I guess. On the event "apply filter" of the form I can run a piece of code to calculate the sub-total.

I have tried this but the sub-totals fields in my footer are in "read only" because I have not specified a unique table in my form. However I cannot choose one (nothing in the listbox) because my record source is proc stock.

I have no idea how to solve this problem.

Thank you guys for your help.

Terry
Aug 25 '06 #8
MMcCarthy
14,534 Recognized Expert Moderator MVP
The calculated fields are unbound fields on your form as in they are not bound to the table or query which is the record source of the form. As such when you update the records the unbound fields are not automatically updated.

However, assuming the field are calculated based on values in the form update, simply requery each calculation. That is:

For each calculated field in the form footer:

Me. FieldName. Requery

If this does not solve your problem please let me know.

Thank you comteck for your reply.

I cannot use "sum" in the source of my form because the form displays a list of results while a "sum" function in a query will return an aggregated line.

I can however calculate the sub-total in another query using VBA code, which is your solution I guess. On the event "apply filter" of the form I can run a piece of code to calculate the sub-total.

I have tried this but the sub-totals fields in my footer are in "read only" because I have not specified a unique table in my form. However I cannot choose one (nothing in the listbox) because my record source is proc stock.

I have no idea how to solve this problem.

Thank you guys for your help.

Terry
Aug 25 '06 #9
terrybens
6 New Member
Hi everybody,

The subtotals text field are unbound fields. I have coded the calculation on the "apply filter" event.

I solved my last difficulty which was a message like "The form is read only because no unique table has been indicated".

I don't know why but changing these parameters of the field : enabled = no, locked = yes solved the problem.

Thank you guys for your replies.

Terrybens
Aug 30 '06 #10

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

Similar topics

5
3044
by: kackson | last post by:
Hi. I would like to access my database outside of my company. I read many documents but they are all pertaining to accessing the database via ASP or some form of web application. Is there no single windows or linux application tht runs natively to access a remote SQL data base? Any advise is appreciated. Thanks!!
7
6421
by: rickcheney | last post by:
I just changed my Access 2002 database to a SQL Server ADP project. I had a form where the user entered a value into a text box and when a command button on the form was clicked a Report was opened. The reports record source is a query. The query uses the value from the form text box to restrict the query. Table name = EggsTable one of the columns in the table is named: EggColor Form name = EggColorForm Form text box name = ColorTextBox
7
6286
by: damjanu | last post by:
Hi All; I need little help. I have a datasheet form. I allow user to do 'filter by selection'. My form contains a column with values. As user changes selections, I want to calculate totals. I can do this the first time the form loads.
0
689
by: M. Farrenkopf | last post by:
I am in the process of converting a Jet database to ADP using SQL Server 2000. Most of this conversation has been smooth, but now I'm running across a problem that has me stumped. Access 2000 SP3 on Windows 2000 Professional. I'm not in charge of the SQL server, so I don't know its OS (presumably irrelevant). Presumably, it's been updated with its latest service packs. With this conversion, I'm moving everything on the VB side from...
0
2246
by: Malcolm Cook | last post by:
I've discovered: Using "File > Print Preview" in a form's datasheet view with a server Filter crashes access after previewing... ....that is, unless ServerFilterByForm has been turned off after applying the filter. See the steps to recreate bug below for details.
13
4444
by: Greg Strong | last post by:
Hello All, Hello All, What are the ToDo's / Gotchas to convert an MDB Access 2K2 database to an Access Project (i.e. ADP) file for the front end using Microsoft SQL Server 2000 Desktop Engine (MSDE 2000) for the back end? Now for the background. I have a prototype MDB file that was built in Access 2K2, and compiled in Access 2K to provide backward
1
3844
by: ken | last post by:
Hi, Lets say we have a form that displays time card entries based on the calendar control date on the form. So the user clicks on a date and the form filters the table where the time card entries come from to get you proper data. In access I would just filter the query(rewrite its qrydef) and I'd get my answer. My question is, what is the proper way of doing this in ADP and SQL Server 2005. I could filter the data from the view on the...
49
4356
by: Allen Browne | last post by:
If you are looking for opinon on what's useful in Access 2007, there's a new article at: http://allenbrowne.com/Access2007.html Covers what's good (useful features), what's mixed (good and bad), what's gone (features removed), what's fixed (old issues solved), what's broken (new bugs), configuration, compatibility, should you buy, and links. It is opinion, so you may disagree, but hopefully it's an informative summary.
8
7172
by: elias.farah | last post by:
Hello Everyone, I'm having some very weird behavior on a couple of Access forms. (Not all forms, just some of them). The forms have been working for years, under Access XP/2003 etc, and last week upgraded from Windows XP/Office 2003 to Vista x64/Office 2007. Under Access 2007, a couple of forms are now taking 60 seconds to
0
9431
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9255
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,...
0
9844
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...
0
9689
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 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...
0
8688
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6514
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5289
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3326
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2647
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.