Sorting Count Fields
Feb 1, 2006How do you sort on a count field in a report
View RepliesHow do you sort on a count field in a report
View Replieshi dear members
i m new in access dont know how make query i wanna sort and count duplicate recorde with the help of query
for example
id numbers total numbers of trade
A 123 98674
B 456 98458
C 674 093253
A 123 84545
A 123 3423
I JUST WANNA COUNT "ID" AND "NUMBERS" COLIMN HOW MANY TIME A USE 123 NUMBERS HOPE U UNDERSTAND MY PROBLEM PLZ LET ME KNOW HOW I SORTED OUT THIS PROBLEM
HELP APPERICIATED
I have a database with different "Categories": hotels, kennels, pet sitters, etc. I need to sort it so that I can export and print it. It needs to be sorted as follows:
State|City|Category. Whenever I do a sort it ends up giving me all of the hotels first (by state and city), then the kennels (same way), and so on. I need them integrated so that within each City, first come the Hotels, then the Kennels, then the Sitters, etc., and then on to the next city.
Is there an easy way to do this, without knowing SQL or other programming?
Below is an example of my table "Pricedata" include 03 fields:
Stock Name ___Price________Status Date
A________________10________ __1/6/2008_
A________________11___________1/7/2008_
A________________12___________1/8/2008__
B________________22___________1/6/2008_
B________________25___________1/7/2008_
B________________29___________1/8/2008__
C________________2____________1/6/2008_
C________________2____________1/7/2008__
C________________3____________1/8/2008_
D________________56___________1/6/2008_
D________________45___________1/7/2008_
D________________27___________1/8/2008__
I want to create a query like this: can calcualte the price change and % price change in certain period, and then sort in % change.
This result should be like the table below:
StockName Change in three days % Change in 03 days
C 1 50%
B 7 31.8%
A 2 20%
D -29 -51.78%
Thanks all,
How is the easiest way to sort fields in a form. A database view sort is no problem but I can find no way to sort a fields in a form short of using a query. I am using Access 2010.
View 2 Replies View RelatedI have a query that creates counts of fields based on the data in other fields, basically it tells me that in a table there are two entries with value ABC????? and three of DEF????? , the query works perfectly.
When I create a form to display this data and base the form on the Query I keep getting a message box asking for the ID (key field) from the base table.
If I type * in the box (to denote all values) and press enter I get the results expected.
I'm trying to use the following code to programmatically sort four fields on the continous subform:
Code:
Me.SPlanChange_03_OFFSET.Form.OrderBy = "AOBJ ASC, ORG ASC, AVAILABLE DESC, AGFND ASC"
Me.SPlanChange_03_OFFSET.Form.OrderByOn = True
It appears that the code works partially - the values in the "AOBJ" field are as they be and so are the values in "AVAILABLE" field. The values in the "ORG" and "AGFND" fields will not sort.
Is what I'm trying to do even possible?
I have 3 fields Yes/No.
A B C
To be in order it is necessary that: A , B and C = Yes.
I would want to print all different combinations :
A = no et B et C = Yes
Then
A: Missing
Nom, prenom et adresse.
.....
.....
A = Yes, B=No and C = No
Then
B and C missing :
Nom, prenom et adresse.
......
.......
Etc.....
I have created a form based on a query. The funny thing is when I tried to sort fields on the form, the following message box pops up:
Syntax Error (Missing Operator) In (Field Name)
I just did the exact same thing several weeks ago, and that first form could sort fields normally. The only difference between the first one and this is that this second query was based on several tables, while the first was based on a single table, although I doubt that is where the problem is.
I forgot to add that I could sort fields where the field name doesn't have spaces in it. For example, the field name "Customer ID" triggers the syntax error, while the field "S/N", "Company", etc. can be sorted like normal.
Hi all.
I've created a database which contains information about stores. I want to have the forms automaticly sorted by the department number.
I've tried to sort the table by department, but when I try to add a department, the sorting doesn't seem to affect the form at all.
Lets say I have department 1,2,3,6,7,8 in the form, and I add department 4, it will be the last post in the form. I want it to be the fourth, and so on..
I'd apreciate some help with this :) Thanks
Here's the database (http://www.access-programmers.co.uk/forums/attachment.php?attachmentid=12934&stc=1&d=1142018915&PHPSESSID=f730b7f11f6983965698faeacbe5a1ee)
I'm building a health data system that stores data from health tests as follows:
[test01], [test02], [test03],.........[test25], etc etc.
Each of these tests comprised of a "Pass"/"Fail" value.
Now, i'm building my queries for a feedback report to hand over to the client that is based solely on the 1 single client record. In other words the queries are designed to return only 1 single data record to be placed in the client report where the based on the corresponding [TestID].
So within this 1 data record i want a query to count the number of times "Pass" appears in the test fields?
ie count([test01] [test02] [test03] [etc] [etc], ="Pass")
As there are some 40-50 [test##] fields in this one test battery i don'y particularly want to go back and code an IIf statement for each component if i can help it.
Many thanks in advance for any tips.
Hey,
I'm currently working on a database for my school project.
Currently, I have a table:
Job:
Contractor_ID [Foreign Key]
...
Contractors:
Contractor_ID [Primary Key]
Contractor [Text]
Basically I want to create a query that shows a table like so:
Wages:
Contractor [Contractors.Contractor]
Jobs_done [counts the number of rows from Job that has the Contractor_ID equal to the Contractor_ID specific to Contractor (above)]
Eg.
Job:
Contractor_ID
1
2
3
2
1
4
Contractors:
Contractor_ID Contractor
1 Bob
2 Bill
3 Jim
4 Jill
Wages:
Contractor Jobs_done
Bob 2
Bill 2
Jim 1
Jill 1
hi there,
I have been struggling over this the past few days and get no where. I am trying to count the number of times Yes appears in a few fields. This is what I have right now in design view:
Field1YesCount: Count(IIF([Field1] = True,1,0))
Field2YesCount: Count(IIF([Field2] = True,1,0))
Field3YesCount: Count(IIF([Field3] = True,1,0))
This doesnt seem to work, could someone please help.
Thanks
hi there,
I have been struggling over this the past few days and get no where. I am trying to count the number of times Yes appears in a few fields. This is what I have right now in design view:
Field1YesCount: Count(IIF([Field1] = True,1,0))
Field2YesCount: Count(IIF([Field2] = True,1,0))
Field3YesCount: Count(IIF([Field3] = True,1,0))
This doesnt seem to work, could someone please help.
Thanks
Hi there. Im trying to work out how I can count the dates in my database per month. What ive done is created an unbound box with an sql statement
SELECT Count([tbl Main].[Date of Call]) AS [CountOfDate of Call]
FROM [tbl Main]
HAVING (((Count([tbl Main].[Date of Call])) Between #4/1/2006# And #4/6/2006#));
When I select the totals button to count the records 0 are pulled out.
Does anyone know if im doing something wrong here. As always im sure its quite simple..
Cheers
Hey all,
I'm having a hard time getting the output below from a query and was wondering if anyone would be able to reproduce this. Basically I'm trying to retrieve products that have more than 5 sales on a specific date and the retailers they sold at. I have the following simplified table.
Table name: SALES
PRODUCT RETAILER SALESDATE
---------------------------------------
PRODUCT1 COMPANY1 10/10/07
PRODUCT1 COMPANY2 10/10/07
PRODUCT2 COMPANY1 10/10/07
I am trying to find which products had more than two sales on the same date, and retrieve the product name, the retailer and the sales
I.E THE ABOVE TABLE WOULD PRODUCE
PRODUCT SALESDATE RETAILER
--------------------------------------
PRODUCT1 10/10/07 COMPANY1
PRODUCT1 10/10/07 COMPANY2
I've been able to only get the first two fields successfully by using
SELECT PRODUCT, SALESDATE
FROM SALES
GROUP BY SALESDATE, PRODUCT
HAVING (Count(PRODUCT)>=2);
MY problem is getting the retailers to appear also. Any help would be appreciated.
Morning All!
Boss-Man has a db (humongous) that (along with a zillion other things) tracks which specific tasks have been completed, who has done it and when did they do it.
All tasks will eventually be completed by all employees.
He's got a query that returns all of the dates on which each task has been completed, using each TASK name as a field.
The short version below shows the TASK1 was completed on 1/1/07, 2/7/06 and 2/17/07, TASK2 was completed on 01/05/07,by 2 people on 2/15/07 and again on 02/28/07 and so on.
TASK1***** TASK 2***** TASK 3 ***** TASK 4
1/1/2007 *** 1/5/2007*** 1/13/2007 *** 1/2/2007
2/7/2006 *** 2/15/2007 *** 1/7/2006 *** 1/15/2007
********** 2/15/2007
2/17/2007******
********** 2/28/2007 ********* 2/28/2006
What he would like to do is be able to show how many tasks were completed in any given week, such as:
WEEK ENDING # TASKS
01/06/07 3
01/13/07 1
02/17/07 2
Looks to me like you'd first have to identify the possible WeekEnding dates and then try to total across all the fields, but I've not got a clue how you'd do that.
Is there an easy way to "query the query", work with Week Ending on Saturday, and get the info he's looking for?
Thanks,
BeckieO
Hey Guys,
I’ve attached a zipped example of the problem I am having with customised navigation buttons.
In my main database the form “subfrmPersonsContact” works perfectly. I have exported it to a new database and now the customised record count fields do not work at all – they are in fact blank even though the navigation buttons do still work.
The code running the form and the record count fields is listed below – I have no idea why it’s not working.
Any help would be greatly appreciated.
Cheers,
Rusty
:D
Private Sub Form_Current()
On Error GoTo err_Form_Current
Dim rs As Recordset
Dim Count As Integer, Position As Integer
Set rs = Me.RecordsetClone
rs.MoveLast
rs.MoveFirst
Count = rs.RecordCount
Me!txtRecCnt = "of " & Count
Position = Me.CurrentRecord
Me!txtRecPos = Position
If Position = 1 Then
Me!gotoPrevious.Enabled = False
Me!gotoFirst.Enabled = False
Else
Me!gotoPrevious.Enabled = True
Me!gotoFirst.Enabled = True
End If
If Position = Count Then
Me!gotoNext.Enabled = False
Me!gotoLast.Enabled = False
Me!txtRecCnt = "of " & Position
Else
Me!gotoNext.Enabled = True
Me!gotoLast.Enabled = True
Me!txtRecCnt = "of " & Count
End If
rs.Close
exit_Form_Current:
Exit Sub
err_Form_Current:
If Err.Number = 3021 Then
Resume Next
Else
Resume exit_Form_Current
End If
End Sub
Is it possible to have a count of all records matching a certain criteria displayed on the form?
I have to schedule customers for certain dates but never know how many have been scheduled by date while in the form. I am not sure how to reference the field from the table to be counted. I have several unbound boxes with:
=date()&" "&{XXXX}([SCHEDULE DATE]=date()
=date()+1&" "&{XXXX}([SCHEDULE DATE]=date()+1
=date()+2&" "&{XXXX}([SCHEDULE DATE]=date()+2
etc.
not sure what to use for {XXXX}
As always, any help is appreciated.....
Someday I will contribute some answers instead of questions.....
Good day:
Code:
=DCount("[DEPARTMENT]","[Query1]","[DEPARTMENT]='ENGINEERING'
I have a query with these fields: DIVISION, DEPARTMENT.
The DIVISION fields are populated with undergrad or grad. The DEPARTMENT fields are populated with ENGINEERING.
I wish to count the occurances of undergrad engineering and count the occurances of grad engineering and return the values in separate text boxes.
Any ideas on how to count occurances of TWO fields?
Thanking in advance.
Dee
If I have a Report, with three fields (all data-type Text) named 'Jan', 'Feb' and 'Mar', and I want to have a fourth field (Unbound) alongside them, providing a count of the number of fields out of these three fields that are populated.
View 2 Replies View RelatedI have a fairly simple query to weed out all the records in our database that are missing vital pieces of infomation :
Code:
SELECT Contacts.Name, Contacts.Address1, Contacts.Address2, Contacts.Town, Contacts.County, Contacts.Country, Contacts.PostCode, Contacts.Telephone, Contacts.Code
FROM Contacts
WHERE (((Contacts.Address1) Is Null) OR ((Contacts.Address2) Is Null) OR ((Contacts.Town) Is Null) OR ((Contacts.County) Is Null));
Is there anyway to count how many fields are missing for each record ?
i have a access table (AUTH) with following field
Company Auth Held
Tata 12
Dell 11
HP 21
Opera 11
Bangour 10
i used the following query to calculate the Held from a table named pers.
SELECT AUTH.company, AUTH.Auth, Count(AUTH.company) AS Held
FROM pers INNER JOIN AUTH ON pers.company = AUTH.company
GROUP BY AUTH.company,AUTH.Auth
then i got the result as under
Company Auth Held
Tata 12 02
Dell 11 08
HP 21 20
Opera 11 12
Bangour 10 12
now i want the difference between Auth and Held as Sur/Defi
how can be it done.
I have a form that records followup activities for protocols. The form allows the user to enter up to six f/u actions from a dropdown menu in six separate fields (called fu1_action, fu2_action, etc).
I am trying to write a query that retrieves only protocols that only have one f/u action selected as "telephone correspondence" and am having trouble. It seems I could write a function in VBA that would somehow loop through the 6 f/u action fields and give a value of 1 to those that have 'telephone correspondence' as a response, and then add them up to give a total of calls for that specific protocol, and then in a separate query only retrieve those that have a total number of calls = 1, but how to get started in writing this.
I have a terrible skill in this but I am doing my best to find ways. But I am running out of time in the development stage. I have the following form and table:
Tables:
Eqpt
EqptHistory
Forms:
frmEqpt
frmHistory
frmEqpt is the Mother form and frmHistory is the subform connected thru eqptID. Now what I want to do is count the records in the frmHistory and Locked the fields for editing. If it is new records, the fields will automatically unlock.
How do I do that because I can't find a way to count the fields with records and lock them.
a table which has several fields (ProjectID, Name, PM, Category, Date, Tester).
I am trying to find a way to count how many of the fields have been filled out and how many are null for a particular Project ID.
For example, ProjectID=27 has a Name and a PM but no more data so when I load the form I want the db to tell me 3 of the fields have been filled out for this project. This way I can calculate how many are empty (3 in this case)
How would I go about doing this