Hi guys,
I have access 2000, I have a form frmCSOC, with a field [CSOC Number] that can have duplicates, I want a label to display how many records there are with DISTINCT [CSOC Number] values.
I have heard that the DISTINCT keyword does not work on Acc2000.
Thanks Guys
5 8251 NeoPa 32,564
Recognized Expert Moderator MVP
DISTINCT & DISTINCTROW are predicates of the SELECT clause in SQL that work fine in Access 2000 and all subsequent versions.
NeoPa 32,564
Recognized Expert Moderator MVP
Hi guys,
I have access 2000, I have a form frmCSOC, with a field [CSOC Number] that can have duplicates, I want a label to display how many records there are with DISTINCT [CSOC Number] values.
I have heard that the DISTINCT keyword does not work on Acc2000.
Thanks Guys
I can't see how the DISTINCT predicate helps you here mind you.
The best way to get this information on your form is probably to use a DCount() call. You haven't provided information on the table (where the actual data is stored - A form is simply a way of interfacing to a table or set of tables via a query).
Assuming a table called [tblCSOC] with a matching field [CSOC Number] then you need some code in your OnCurrent event procedure : - Private Sub Form_OnCurrent()
-
lblCount = DCount("[CSOC Number]", _
-
"[tblCSOC]", _
-
"[CSOC Number]=" & Me![CSOC Number])
-
End Sub
ADezii 8,834
Recognized Expert Expert
Hi guys,
I have access 2000, I have a form frmCSOC, with a field [CSOC Number] that can have duplicates, I want a label to display how many records there are with DISTINCT [CSOC Number] values.
I have heard that the DISTINCT keyword does not work on Acc2000.
Thanks Guys
1__ SELECT DISTINCT tblTest.[CSOC Number] FROM tblTest will return all Unique CSOC Numbers
2__ DCount("*","qry CSOCNumber") where the underlying SQL for qryCSOCNumber is listed above,will return the Total Number of Records containing Unique CSOCNumber values. If I'm not mistaken, this is what you are looking for.
Sorry for the misunderstandin g, my initial post was not very clear.
What I want to do is display the total number of records with a distinct value.
Below is the table tblCSOC, from this table there are 9 records, and 5 distinct [CSOC Number], I would like the label to always display 5, so the user always knows how many CSOCs have been put into the database - CSOC Number Issue
-
10303 1
-
10303 2
-
10303 3
-
11321 1
-
11321 2
-
12101 1
-
12300 1
-
12301 1
-
12301 2
Thanks NeoPa
NeoPa 32,564
Recognized Expert Moderator MVP
It looks like ADezii already answered your question for you (twice now but you can't see the deleted post ;))
You could also do it in SQL directly as : - SELECT Count([CSOC Number])
-
FROM (SELECT DISTINCT [CSOC Number]
-
FROM [tblCSOC])
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Paxton |
last post by:
Hi,
I'm trying to display the total page views per page within a given date
range, but the correct SQL is seemingly beyond me. I get the correct result
with a straightforward Group By and Count clause eg
SELECT DISTINCT tblPageViews.PageVisited,
Count(tblPageViews.PageVisited) AS CountOfPageVisited
FROM tblPageViews
GROUP BY...
|
by: Leny |
last post by:
Hi,
Since Access doesn't support COUTN DISTINCT, I'm facing a new
problem I didn't take into account: how to get the count of PK's in a
complex query. I create queries on the fly -this means I can't use a
stored macro or even a query view-.
A simple example: Let's say you have a simple database with three
tables: People, Laguages and a...
|
by: keith |
last post by:
I am trying to get a exact count of different distinct entries in an
Access column. At first, I was trying to work with three columns, but
I've narrowed it down to one to simplify it. I've searched Google
Groups for Distinct Count and Count, the Microsoft Help file (which
apparently has bad links in Office 2003), and looked at other files,...
|
by: mathilda |
last post by:
My boss has been adamant that SELECT DISTINCT is a faster query than
SELECT all other factors being equal. I disagree. We are linking an
Access front end to a SQL Server back end and normally are only
returning one record. She states that with disctinct the query stops
as soon as it finds a matching record. Both of us are relative novices...
|
by: pierrelap |
last post by:
Hello, I need to code a query that:
1-counts the number of time two companies have been in a deal together
2-in the five years that preceded the deal
Lead Participant DealDate
AAA BBB 01/01/1990
BBB AAA 01/01/1991
AAA BBB 01/01/1992
AAA BBB 01/01/1993
AAA BBB 01/01/1994
| |
by: MP |
last post by:
vb6,ado,mdb,win2k
i pass the sql string to the .Execute method on the open connection to
Table_Name(const) db table
fwiw
(the connection opened via class wrapper:)
msConnString = "Data Source=" & msDbFilename
moConn.Properties("Persist Security Info") = False
moConn.ConnectionString = msConnString
moConn.CursorLocation = adUseClient...
|
by: Bill |
last post by:
I'm trying to write a query that will select a distinct count of more
than one field. I have records that display user productivity. Each of
the records have a time associated with it and I want to be able to
tell the distinct count of the products numbers and of the pallets ID
that they worked with. Do need to work out some sort of sub-query...
|
by: newnewbie |
last post by:
Desperately need help in creating a query to count unique values in a table. I am a Business analyst with limited knowledge of Access….My boss got me ODBC connection to the underlying tables for our system and thinks I am omnipotent now and can extract any data out of it in the form he wants….The truth is, though I know SOME Access, I am not a...
|
by: CampbellJD1 |
last post by:
I am using Access 2003 Professional. I have been working with Access for some time and I have created an MDB with a Linked Table and the Data there is temporarily transferred to other Table for different reports. I now have the task of a Daily report which I have been able to get to the point where it does 90% of what I need. I have been searching...
|
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...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |