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

Is this possible? please help (MS access query of sql database)

I work for an organisation that uses a bespoke document imaging system, the
database of which is an MS sql server.
We have MS Access and already use it for some querying of the database.
The database comprises a large number of distinct cases, which are
differentiated by case reference numbers, in one field (table?) of the
database. Each of these cases may have many documents associated with it,
denoted by the reference number, and these documents may be "new", "pending"
or "complete" shown in another data field.
We need to know how many cases have work outstanding on them.
Our problem is that our bespoke software will only count the number of
documents of each status, and not the cases.

Is it possible to design an MS Access query which will count the number of
different reference numbers which have any "new" documents associated, but
wont count each case more than once?

I am reasonably computer-savvy, I just don't know Access or SQL..
If I know it is possible, I don't mind putting in the effort to find out
how. I just don't want to waste time barking up the wrong tree ;-)

Of course any advice about how this would be achieved, such as pointers to
the right parts of the MS Access helpfiles, or to relevant websites would be
greatly appreciated. Some quick code would be even better...
Also, if there is any 3rd-party software which could easily do this, I need
help discovering it...I have looked long and hard, but don't know enough
about what I am looking for.
Yours in hope..
--
anthonyberet
Please reply in the groups, as my Usenet email address is not working at the
moment.

Jul 20 '05 #1
5 4062
anthonyberet wrote:
I work for an organisation that uses a bespoke document imaging
system, the database of which is an MS sql server.
We have MS Access and already use it for some querying of the
database.
The database comprises a large number of distinct cases, which are
differentiated by case reference numbers, in one field (table?) of the
database. Each of these cases may have many documents associated with
it, denoted by the reference number, and these documents may be
"new", "pending" or "complete" shown in another data field.
We need to know how many cases have work outstanding on them.
Our problem is that our bespoke software will only count the number of
documents of each status, and not the cases.

Is it possible to design an MS Access query which will count the
number of different reference numbers which have any "new" documents
associated, but wont count each case more than once?

I am reasonably computer-savvy, I just don't know Access or SQL..
If I know it is possible, I don't mind putting in the effort to find
out how. I just don't want to waste time barking up the wrong tree ;-)

Of course any advice about how this would be achieved, such as
pointers to the right parts of the MS Access helpfiles, or to
relevant websites would be greatly appreciated. Some quick code would
be even better...
Also, if there is any 3rd-party software which could easily do this,
I need help discovering it...I have looked long and hard, but don't
know enough about what I am looking for.
Yours in hope..


You'd probably be better off in an MS Access group - try
microsoft.public.access
Jul 20 '05 #2
Gordon Burgess-Parker wrote:
anthonyberet wrote:
I work for an organisation that uses a bespoke document imaging
system, the database of which is an MS sql server.
We have MS Access and already use it for some querying of the
database.
The database comprises a large number of distinct cases, which are
differentiated by case reference numbers, in one field (table?) of
the database. Each of these cases may have many documents associated
with it, denoted by the reference number, and these documents may be
"new", "pending" or "complete" shown in another data field.
We need to know how many cases have work outstanding on them.
Our problem is that our bespoke software will only count the number
of documents of each status, and not the cases.

Is it possible to design an MS Access query which will count the
number of different reference numbers which have any "new" documents
associated, but wont count each case more than once?

I am reasonably computer-savvy, I just don't know Access or SQL..
If I know it is possible, I don't mind putting in the effort to find
out how. I just don't want to waste time barking up the wrong tree
;-)

Of course any advice about how this would be achieved, such as
pointers to the right parts of the MS Access helpfiles, or to
relevant websites would be greatly appreciated. Some quick code would
be even better...
Also, if there is any 3rd-party software which could easily do this,
I need help discovering it...I have looked long and hard, but don't
know enough about what I am looking for.
Yours in hope..


You'd probably be better off in an MS Access group - try
microsoft.public.access


And I didn't see ALL those crossposts..... doh!
Jul 20 '05 #3
On Sat, 18 Oct 2003 01:03:05 +0100, "anthonyberet"
<wi******@sneakemail.com> wrote:
I work for an organisation that uses a bespoke document imaging system, the
database of which is an MS sql server.
We have MS Access and already use it for some querying of the database.
The database comprises a large number of distinct cases, which are
differentiated by case reference numbers, in one field (table?) of the
database. Each of these cases may have many documents associated with it,
denoted by the reference number, and these documents may be "new", "pending"
or "complete" shown in another data field.
We need to know how many cases have work outstanding on them.
Our problem is that our bespoke software will only count the number of
documents of each status, and not the cases.

Is it possible to design an MS Access query which will count the number of
different reference numbers which have any "new" documents associated, but
wont count each case more than once?

I am reasonably computer-savvy, I just don't know Access or SQL..
If I know it is possible, I don't mind putting in the effort to find out
how. I just don't want to waste time barking up the wrong tree ;-)

Of course any advice about how this would be achieved, such as pointers to
the right parts of the MS Access helpfiles, or to relevant websites would be
greatly appreciated. Some quick code would be even better...
Also, if there is any 3rd-party software which could easily do this, I need
help discovering it...I have looked long and hard, but don't know enough
about what I am looking for.
Yours in hope..


this is very difficult without any idea of the tables involved, but
lets try;

Table: Cases
(caseNumber integer) *PK

Table: Documents
(docNumber integer,
caseNumber integer, *FK
status varchar(20))

SELECT COUNT(1) FROM Cases
WHERE caseNumber IN
(SELECT caseNumber
FROM Documents WHERE status='New')

Of course if your tables don't look like this then you need another
approach....
Jul 20 '05 #4
Lyndon Hills wrote:
On Sat, 18 Oct 2003 01:03:05 +0100, "anthonyberet"
<wi******@sneakemail.com> wrote:
I work for an organisation that uses a bespoke document imaging
system, the database of which is an MS sql server.
We have MS Access and already use it for some querying of the
database. The database comprises a large number of distinct cases,
which are differentiated by case reference numbers, in one field
(table?) of the database. Each of these cases may have many
documents associated with it, denoted by the reference number, and
these documents may be "new", "pending" or "complete" shown in
another data field. We need to know how many cases have work
outstanding on them. Our problem is that our bespoke software will
only count the number of documents of each status, and not the cases.

Is it possible to design an MS Access query which will count the
number of different reference numbers which have any "new" documents
associated, but wont count each case more than once?

I am reasonably computer-savvy, I just don't know Access or SQL..
If I know it is possible, I don't mind putting in the effort to find
out how. I just don't want to waste time barking up the wrong tree
;-)

Of course any advice about how this would be achieved, such as
pointers to the right parts of the MS Access helpfiles, or to
relevant websites would be greatly appreciated. Some quick code
would be even better... Also, if there is any 3rd-party software
which could easily do this, I need help discovering it...I have
looked long and hard, but don't know enough about what I am looking
for. Yours in hope..


this is very difficult without any idea of the tables involved, but
lets try;

Table: Cases
(caseNumber integer) *PK

Table: Documents
(docNumber integer,
caseNumber integer, *FK
status varchar(20))

SELECT COUNT(1) FROM Cases
WHERE caseNumber IN
(SELECT caseNumber
FROM Documents WHERE status='New')

Of course if your tables don't look like this then you need another
approach....


I think only 2 tables are relevant in the first instance - "reference" and
"status".
Can you rcommend a site where I can read about the functions of the
intructions you have posted?
In particular, the "SELECT COUNT(1) FROM Cases" bit looks very powerful.
However, is this SQL or is it bespoke code used by MS Access?
Thank you for your help.
--
Put "usenet" in the subject-line if you want to mail me, otherwise it will
bounce.
Do you use filesharing networks? If so, please visit my online poll:
http://vote.sparklit.com/web_poll.spark/780772
anthonyberet
Jul 20 '05 #5
On Mon, 20 Oct 2003 23:33:41 +0100, "anthonyberet"
<wi******@sneakemail.com> wrote:

<snip>
SELECT COUNT(1) FROM Cases
WHERE caseNumber IN
(SELECT caseNumber
FROM Documents WHERE status='New')

I think only 2 tables are relevant in the first instance - "reference" and
"status".
Can you rcommend a site where I can read about the functions of the
intructions you have posted?
In particular, the "SELECT COUNT(1) FROM Cases" bit looks very powerful.
However, is this SQL or is it bespoke code used by MS Access?
Thank you for your help.


I would google for sql tutorials. www.sqlcourse.com looks basic. Also
there should be some of this at least in the access help files. I
guess you do need to know what your looking for though. Above, all the
words in capitals are sql keywords, and they should be in the help
files. The IN is a subselect which could be replaced with EXISTS and a
slightly different syntax.

SELECT COUNT() FROM, just counts the number of rows that meet the
conditions. It just returns one number, not the actual rows of data.
There are similar options like MAX, MIN AVERAGE which apply to number
columns. A quick word of warning if you plan to use them, be careful
of the case where the number column is null. Average in particular may
give wrong results.

SQL has relatively few keywords, although each of the big
manufacturers have added their own.
Jul 20 '05 #6

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

Similar topics

3
by: cooldv | last post by:
i am running a website on Windows 2000 server with ASP 3 webpages and Access 2000 database. (with a hosting company) traffic is slow at this time but expect to grow. lately i have been reading...
0
by: Sinead ORiordan | last post by:
I am running a vb6 application which accesses an SQL server database and an Access database. I have a table in the access db which is populated every time i run the vb app. However, when i run...
3
by: Omavlana | last post by:
Hi, How to get the value as 0 insted of NULL if there is no data found in the database for a particular column in the following Access query. select col1, col2 from tab1; If there are null...
5
by: Chand | last post by:
Private Sub tbDate_AfterUpdate() Dim cnn As New ADODB.Connection Dim rst As New ADODB.Recordset rst.CursorLocation = adUseClient Set cnn = CurrentProject.Connection rst.Open "SELECT * FROM...
7
by: Rob Richardson | last post by:
Greetings! I am rewriting a VB6 application in VB .Net. The database (which was converted from Access 97 into Access 2000) has two nearly identical queries. One, called GetNewOrderNumber, is: ...
5
by: Art | last post by:
Hi, Can anyone point me to an example of how I would execute a query I've created in an Access DB. I've copied the SQL down to my VB.net application and that works fine, but it's ugly. I'd like...
3
by: austin1539 | last post by:
I am trying to run an Access query from Excel. The query, called "ProdActs1" works in Access and is run from using information from a table called "Queries". When a button is clicked in Excel, data...
2
by: Aussie Rules | last post by:
Hi, I have a access 2007 database with a cross tab query. Based on the selection critieria the cross tab may contain a different number columns in the result. For example if the query is...
6
by: jsacrey | last post by:
Hey everybody, got a secnario for ya that I need a bit of help with. Access 97 using linked tables from an SQL Server 2000 machine. I've created a simple query using two tables joined by one...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.