473,387 Members | 1,859 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,387 software developers and data experts.

Dcount -> SQL

I posted this about a week ago, and I got some interesting responses,
but none of them acually answered what I was asking, so I'll try
again..

I have read a few articles that state that a multi-user app over a
network will run faster if DSum & DCount functions are replaced with
SQL statements replicating the functions.What would be a SQL statement
that would be functionally equal to DCount ? As I am a novice to SQL,
anysuggestions would be hugely appreciated. Thanks.

May 3 '06 #1
5 5201
CurrentProject.Connection.Execute("SELECT SUM(Graft) FROM Politicians
WHERE Dishonest AND YEAR([Date]) = 2006").Collect(0)

CurrentProject.Connection.Execute("SELECT COUNT(*) FROM Foxes WHERE
Attitude LIKE 'Loves%'").Collect(0)

May 3 '06 #2
> I have read a few articles that state that a multi-user app over a
network will run faster if DSum & DCount functions are replaced with
SQL statements replicating the functions.What would be a SQL statement
that would be functionally equal to DCount ? As I am a novice to SQL,
anysuggestions would be hugely appreciated. Thanks.


In SQL you can use SUM and COUNT operators.

SELECT SUM(field1) AS field1Sum, COUNT(field2) AS field2Count
FROM myTable
GROUP BY fieldX, fieldY,.......

--
PBsoft di Gabriele Bertolucci
www.pbsoft.it
skype: pbsoftsolution
May 3 '06 #3
Lyle, could you explain what .Collect(0) is doing? I've had a look through
Access help with no joy

TIA,

Mark

"Lyle Fairfield" <ly***********@aim.com> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com...
CurrentProject.Connection.Execute("SELECT SUM(Graft) FROM Politicians
WHERE Dishonest AND YEAR([Date]) = 2006").Collect(0)

CurrentProject.Connection.Execute("SELECT COUNT(*) FROM Foxes WHERE
Attitude LIKE 'Loves%'").Collect(0)

May 3 '06 #4
It's an undocumented function (both ADO and DAO) for
..Fields(index).Value.
In testing some years ago I found it is faster than anything except
declaring a specific reference to a field.
You can find many undocumented methods and properties in Access by
opening any Module, going to the Object Browser (<F2>), right clicking
and selecting Show Hidden Members. Some of these are useful. When you
do this the hidden members Hidden Members are not guranteed to work in
future versions of Access. I was warned about this ten years ago. But
they all still work.
The Object Browser is often much more helpful than Help, which shows
everything that should be available, while the Object Browser shows you
what is available.

May 3 '06 #5
Cheers for the info Lyle, very helpful!!!!

Mark

"Lyle Fairfield" <ly***********@aim.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
It's an undocumented function (both ADO and DAO) for
.Fields(index).Value.
In testing some years ago I found it is faster than anything except
declaring a specific reference to a field.
You can find many undocumented methods and properties in Access by
opening any Module, going to the Object Browser (<F2>), right clicking
and selecting Show Hidden Members. Some of these are useful. When you
do this the hidden members Hidden Members are not guranteed to work in
future versions of Access. I was warned about this ten years ago. But
they all still work.
The Object Browser is often much more helpful than Help, which shows
everything that should be available, while the Object Browser shows you
what is available.

May 6 '06 #6

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

Similar topics

7
by: jdph40 | last post by:
I posted this problem previously and received excellent help from Wayne Morgan. However, I still have an unanswered question. My form (frmVacationWeeks) is opened from the OnClick event of a...
1
by: Megan | last post by:
Hi Everybody- I've been reading some of the posts about DCOUNT, and I haven't yet found an answer; so, I'm posting this question. I have a report that I'm trying to use DCOUNT on to compute...
4
by: Will | last post by:
Hi, I had a DCount within a module on records in a table where CustSuffix = 0. I now need to DCount where CustSuffix = 0 and the type of cost Suffix (Suffix in table) = G. I can't get both...
6
by: Mike Conklin | last post by:
This one really has me going. Probably something silly. I'm using dcount for a report to determine the number of different types of tests proctored in a semester. My report is based on a...
2
by: Paul T. RONG | last post by:
Hi, I have a problem with DCount, the following code doesn't work: DCount("", "qryOrder", "( = Me! AND = 'drink')" > 0 Please help. Thank you.
3
by: BerkshireGuy | last post by:
I am having difficulty with using the Dcount function. I am trying to return the number of records from qryIndividualFeedbackDetail where the TimelyManner field is set to 4. So, in the new...
2
by: Kaspa | last post by:
Hello I am trying to create dcount field but is not working I have tried every way possible and I can't get it to work. here is my code: =Dcount("","qryTotalscratched"," in (6,7,8,9) and ...
2
by: ChasW | last post by:
Greetings, I have a form that uses a query as its record source. In the form I have a text box that uses this as its control source: =DCount("", "qry_Search_by_Name") The DCount function...
2
by: Wingz | last post by:
Hiya, Fairly new to Access and was wondering what the best way to perform Dcounts on groups in an Access report. For example, I have 10 employees and the different instances of jobs they can...
8
by: Susan Bricker | last post by:
I have used DCount() to determine the number of records in a recordset. Silly me ... I just noticed that DCount returns an INTEGER, which can hold a maximum value of 32,767. What if the recordset...
0
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,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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.