Solved

domain function question

Posted on 2014-02-19
4
287 Views
Last Modified: 2014-02-20
Hi all,

I need to know what is the most efficient way to get the following in vba

count of distinct dates for certain criteria.

for example, how many distinct dates are scheduled for this week.

two schedule records for Sunday are considered 1, while Sun, Mon, Tue are counted as 3.

I know I can do it in a saved distinct query and use DCount of that query, however wonder if that is the most efficient way of accomplishing it, as i am dealing with a very large table.
0
Comment
Question by:bfuchs
  • 2
  • 2
4 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 39871944
start with this

Select Count(A.Dates) as CountOfSchedules
from
(select TableX.Dates From TableX
  Group By TableX.Dates
) As A
0
 
LVL 4

Author Comment

by:bfuchs
ID: 39871950
hi,
and how do i get this results into a variable?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39871971
save the above query as QCount

open it as recordset

dim rs as dao.recordset, xCount as integer
set rs=currentdb.openrecordset("QCount")

xCount=rs!CountOfSchedules
0
 
LVL 4

Author Closing Comment

by:bfuchs
ID: 39874778
Thanks allot Ray, that worked, however just wonder if the following approach would perform faster?
create a SQL function that accepts a int variable and returns a int, then have this function being called from the app.
p.s. its a ms access front end application linked to SQL Server back end.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question