Been at this for two days now...
I have a customer database with various fields, two of which are:
ContactID (an autonumber field) & ReferralID (long Integer)
When a customer refers someone new, the new customer gets the referee's
ContactID in their ReferralID field. So someone who refers 10 people
will have 10 instances of their ContactID scattered down the ReferralID
column.
I am basically trying to count the number of referrals that a customer
has by counting all the instances of ReferralID which equal their
ContactID.
I have tried Dcount, Queries, VBA and SQL to no avail...
It sounds simple, but I can't figure it out! I saw somewhere that it
may have to do with the autonumber field not being a standard long
integer, but that may be off...
Thanks... 4 7770
In the Query Builder, drag down into the grid ContactID and ReferralID.
Then, on the menu, View | Totals. In the "Total:" line, chose Count under
ContactID and Group By under ReferralID. Run the Query.
Larry Linson
Microsoft Access MVP
<al************ ******@gmail.co m> wrote in message
news:11******** **************@ y43g2000cwc.goo glegroups.com.. . Been at this for two days now...
I have a customer database with various fields, two of which are:
ContactID (an autonumber field) & ReferralID (long Integer)
When a customer refers someone new, the new customer gets the referee's ContactID in their ReferralID field. So someone who refers 10 people will have 10 instances of their ContactID scattered down the ReferralID column.
I am basically trying to count the number of referrals that a customer has by counting all the instances of ReferralID which equal their ContactID.
I have tried Dcount, Queries, VBA and SQL to no avail...
It sounds simple, but I can't figure it out! I saw somewhere that it may have to do with the autonumber field not being a standard long integer, but that may be off...
Thanks...
Thanks for the reply Larry.
I got that far, but the point I am stuck at is being able to display
the number of referrals on a form.
To clarify, I have a form with all the customer details (including a
textbox for the number of referrals they have had). I want a field on
the form to display the number of referrals that only the current
ContactID has (presumably from the output of the query).
Thanks again.
Larry Linson wrote: In the Query Builder, drag down into the grid ContactID and ReferralID. Then, on the menu, View | Totals. In the "Total:" line, chose Count under ContactID and Group By under ReferralID. Run the Query.
Larry Linson Microsoft Access MVP
<al************ ******@gmail.co m> wrote in message news:11******** **************@ y43g2000cwc.goo glegroups.com.. . Been at this for two days now...
I have a customer database with various fields, two of which are:
ContactID (an autonumber field) & ReferralID (long Integer)
When a customer refers someone new, the new customer gets the referee's ContactID in their ReferralID field. So someone who refers 10 people will have 10 instances of their ContactID scattered down the ReferralID column.
I am basically trying to count the number of referrals that a customer has by counting all the instances of ReferralID which equal their ContactID.
I have tried Dcount, Queries, VBA and SQL to no avail...
It sounds simple, but I can't figure it out! I saw somewhere that it may have to do with the autonumber field not being a standard long integer, but that may be off...
Thanks...
Got it!
for anyone else with the same trouble, I ran this:
UPDATE Contacts SET Referrals = DCount("*", "Contacts", "[ReferrerName]
= " & [ContactID]); al************* *****@gmail.com wrote: Thanks for the reply Larry.
I got that far, but the point I am stuck at is being able to display the number of referrals on a form.
To clarify, I have a form with all the customer details (including a textbox for the number of referrals they have had). I want a field on the form to display the number of referrals that only the current ContactID has (presumably from the output of the query).
Thanks again.
Larry Linson wrote: In the Query Builder, drag down into the grid ContactID and ReferralID. Then, on the menu, View | Totals. In the "Total:" line, chose Count under ContactID and Group By under ReferralID. Run the Query.
Larry Linson Microsoft Access MVP
<al************ ******@gmail.co m> wrote in message news:11******** **************@ y43g2000cwc.goo glegroups.com.. . Been at this for two days now...
I have a customer database with various fields, two of which are:
ContactID (an autonumber field) & ReferralID (long Integer)
When a customer refers someone new, the new customer gets the referee's ContactID in their ReferralID field. So someone who refers 10 people will have 10 instances of their ContactID scattered down the ReferralID column.
I am basically trying to count the number of referrals that a customer has by counting all the instances of ReferralID which equal their ContactID.
I have tried Dcount, Queries, VBA and SQL to no avail...
It sounds simple, but I can't figure it out! I saw somewhere that it may have to do with the autonumber field not being a standard long integer, but that may be off...
Thanks...
On 4 Jun 2006 13:51:38 -0700, al************* *****@gmail.com wrote: Got it!
for anyone else with the same trouble, I ran this:
UPDATE Contacts SET Referrals = DCount("*", "Contacts", "[ReferrerName] = " & [ContactID]);
Thanks for asking the question and posting your follow-up. I have a
similar need and you've saved me a lot of head-scratching. Thanks of
course to the experts too. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: leegold2 |
last post by:
Below is some code from a FULLTEXT search. My question is how do I get a
count of the number of rows found by the search?
$query="SELECT * FROM balloon_txt WHERE MATCH(access_no, recs_txt)
AGAINST ('meteorology')";
$result = MySQL_query($query);
|
by: C. Homey |
last post by:
I have an Access 2000 database (42,000+ records) for which I need a
count of records by state (AL=320, AK=92, NY=1,932, etc). Obviously,
I don't want to (and probably can't...) do the count manually. I know
there is a Count function, but I don't know how to make it work. Can
anyone help me, please?
As an aside, I tried to export the data to an Excel spreadsheet, but
it will NOT save as a new file. I have no idea why that is the case...
|
by: Terri |
last post by:
I have a form with a multi-select combo. I dynamically build a SELECT
statement, open a report, and set the recordsource to my dynamic SELECT
statement. I count the records returned in the report by setting a text box
to =Count(*). This works fine.
Now I want to count the unique records in my report. I can dynamically
create a SELECT statement that counts unique records. My statement looks
like this:
SELECT DISTINCT...
|
by: Hugo L. |
last post by:
Dear
I have a table with a Text field named "Attest". In that field I can
fill in 4 possibilities: A, B, C or D.
In a report based om that table I want to count how many times I
filled in something. With =Count() this works perfectly.
Now I want to count how many times I filled in A (or B, ...). Whatever
I try, this doesn't work. Can anybody help me?
Thank you!
Hugo L.
|
by: Nicolae Fieraru |
last post by:
Hi All,
I have a query, Select Count(BoolField) from tblMyTable, Where BoolField =
true.
If I run the query by itself, it returns the number of true records
I want to use the result of that query in my VBA code, like this:
If (result of the query > 0) then
do something
| |
by: John |
last post by:
I've got a single table I need to query to return records that have no
"related records."
Table dataset example:
1. John, Biology
2. Dave, Math
3. Susan, Biology
4. Betty, Sociology
The query should return this dataset:
|
by: Hyphessobricon |
last post by:
Hallo,
Indeed, a count of a query with a group by function gives more records than
there are and so for-next structures don't function.
How is this to be mended.
Anyone? Everyone in fact.
Answers are greatly appreciated.
--
mvg Hyphessobrycon
|
by: Anuradha |
last post by:
Dear Experts
How can I count records in a data reader?
Thx
Anuradha
|
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
moConn.Mode = adModeReadWrite' or using default...same result
|
by: petter |
last post by:
Hi!
I have two questions: one question that regards the COUNT-function, and one about how to display a month even if I don’t have any data for that month.
I have an Access database where I want to create a query to count all the internal units in my list (the “input”-table), between two dates. I want my list to be grouped by year and month. Here is the SQL-code, as called from VBA:
strSQL_INTU1 = "PARAMETERS DateTime, DateTime;" _
...
|
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,...
| |
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
| |
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |