How To Sort Records Within This Query

May 16, 2007

In order to do a report, I would like to make it so that each customer is on its own row within this query, with his or her total days added up. I have no idea how to go about it.

http://img329.imageshack.us/img329/6313/untitledao2.jpg

appreciate any help:o

View Replies


ADVERTISEMENT

Queries :: Sort Out Invoices By Year - Query Based On Combo Box To Show All Records

Mar 4, 2015

I am trying to have a query sort out my invoices by year but also to have the possibility to show all invoices.

I have one table "INVOICE" where I have a column "YEAR" calculated with DatePart function from the invoice date.

On my form "INVOICE LISTING", I want to have a combox "Combo957" selecting the year. I have forced the "ALL" selection to the combox using a UnionQuery.

My problem, I cannot get the query to work. I have tried many ways, the closest I can get is :

IIf([Forms]![Invoice Listing]![Combo957]="ALL",([Invoice].[Year])<Year(Date()),[Forms]![Invoice Listing]![Combo957])

If I select the year from the combo, it works, if I select "ALL" nothing is shown.

here is the full SQL

SELECT DISTINCTROW Companies.Company, Companies.City, Companies.Country, Sales.Brand, Sales.Type, Sales.Date, Sales.QuoteNo, Sales.Delivered, Sales.Account, Sales.Branch, Invoice.InvoiceNumber, Invoice.InvoiceDate, Invoice.CustOrderNumber, Invoice.PaymentTerms, Invoice.DueDate, Invoice.NetAmount, Invoice.TotalAmount, Invoice.Tax, Invoice.PaiementRCVD, Invoice.Overdue, Invoice.Month, Year([Invoice]![DueDate]) AS DueYear, [Invoice]![month] & " - " & [Invoice]![Year] AS InvoiceMonth

[Code] .....

View 5 Replies View Related

Report Sort Different From Query Sort

Mar 3, 2006

i made a report based on a query. when i run the query, my results are sorted by Job Time Ascending, like i want...
when i made my report i chose job id as the main group priority in the wizard..

now in my report it displays the jobs in ID ascending, rather than Job time ascending as my query says..

i dont want to re-do the report it took ages.. how can i fix this?

View 3 Replies View Related

Report Sort Is Not The Same As Query Sort...

Jan 9, 2005

I have a query that sorts players batting averages from highest to lowest. When I run the query just by itself it sorts it right however when I open the report based on that query it does not sort in descending order like I asked. What am I missing??

View 3 Replies View Related

Sort Records

Oct 6, 2006

Hello,

I have a cbo which filters records to a listbox. In the after update event of the cbo I have the following code:

Dim mySQL, mySelectedName
mySelectedName = Me.[cboname]

mySQL = "select LASTNAME, FIRSTNAME, FROM Master WHERE [USER] = '" & mySelectedName & "';"
Me.[lstbox].RowSource = mySQL


Master is my table.
cboname is the cbobox I use to run the code
USER is a table which gives the data to my cbo.

Is there a way I can sort data in the listbox by LASTNAME (Ascending).

Thanks.

View 2 Replies View Related

Sort By Oldest Date First (records)

Nov 16, 2006

Hello All,

I currently have a form where I would like the form to display the oldest account first, so the overall objective is the employee will action the oldest account first and then go onto the next one etc.

Can anyone please tell me how to do this?

Thank You.

Mos

View 2 Replies View Related

Sort Subform Records By Date

Dec 31, 2007

I created my first RDB input form and it works fine. In the subform new records are created at the bottom row. The subform has a date field. The main and sub forms are based on tables.

When I open the input form I would like to see the subform records sorted by the date field but I don't know where to look for help on that. Can somebody point me in the right direction?

I am including my form in design layout just in case it will help.

[URL=http://pipsisiwah.home.bresnan.net/images/access_screen01.jpg[/URL]

View 3 Replies View Related

Reports :: Can't Sort Records In Sub-report

Oct 29, 2013

I am using Access 2007.I have a report that has 2 subreports within it.One of the sub reports input is from a table (Work Order Parts) whose records have a field called "DisplayOrder". This is a numeric field that I use to enable the user to specify the exact order that they want the records to be displayed in a form or report...well that's the plan anyway.

I can't seem to get the subreport to sort on the "DisplayOrder" field.

I have tried to set the Property value "Display Order" to "[Workorder Parts].DisplayOrder" but this doesn't seem to make a difference. The "Order By on Load" is set to "Yes".

Here is the "Record Source" value : SELECT DISTINCTROW [Workorder Parts].*, Parts.PartName, [Workorder Parts].Notes FROM Parts INNER JOIN [Workorder Parts] ON Parts.PartID = [Workorder Parts].PartID;

What am I doing wrong?

View 5 Replies View Related

Forms :: Add Button To Sort Records

Jan 19, 2015

Ive created a form and one of the fields is a field called "Due Date"

I want to create a button that once pressed will sort the records in order of due date with the oldest being record 1.

How I can get a button to manipulate fields.

Ive got a set of buttons at the bottom of my form (Ive placed them in the footer) that were set up using Access automatically. They go to first, last, next and previous records. Ive also set up two extra, one that creates a new record and another that sets the record.

The thing is that the set record button I would actually like it to take the data in a field called "Frequency", add a random number to it and then set the record.

View 1 Replies View Related

Sort Records Based On Fiscal Year

Oct 14, 2005

I would like to sort records based on fiscal year for a chart. The fiscal year would be 7/01/2003 to 06/30/2004. I would like to sort this based on oldest date to newest date. This query could span several fiscal years. Any help would be greatly appreciated.

View 7 Replies View Related

List Records By Desired Groups Instead Of Sort

Aug 3, 2007

Data in table “tblEmployees”:

EmpName GroupNum
Jon Group1
Sam Group2
Tom Group1
Bob Group1
Hal Group2
Dan Group3
Cal Group2

With sample table above, can I write a query in Access that lists the data by GroupNum based on my criteria, say Group2 1st, then Group3, then Group1? Basically, how do I make the result show:

Sam Group2
Hal Group2
Cal Group2
Dan Group3
Jon Group1
Tom Group1
Bob Group1

View 3 Replies View Related

Subform Records Change Sort Order

May 8, 2005

I have a subform embedded in a mainform which contains loan payment details over a number of months. The record starts with the payment period number ie 1,2,3 etc. The problem is that every now and again the subform changes the display order of the records so that I get 4,5,6,1,2,3.

When I look at the underlying table the order is OK as is the non embedded sub form. I cannot see any reason for the change and it only happens randomly (apparently).

The numbers are not autonumbering but manually input.
Hope someone can help please.

View 1 Replies View Related

General :: Updating Sort Order Of Records

Nov 10, 2014

I have a table with entries describing a sequence of Tasks (tblTask)

tskID TaskDescription
10 Clean Room
12 Wash Dishes
etc

I have second table called Steps (tblSteps) that is related to tblTask via the field "StepNumber" which is a concatenation of [tskID] & "." & [StepOrder]
So if we look at washing dishes as a task then the steps are as follows:

StepID, StepDescription, StepOrder, StepNumber
202 Put plug in the sink , 1, 12.1
512 Turn on tap, 2, 12.2
205 Put in detergent, 3, 12.3
210 Place dishes in sink, 4, 12.4
435 Turn off tap, 5, 12.5
etc

If I decide delete the third step I get the following:-

StepID, StepDescription, StepOrder, StepNumber
202 Put plug in the sink, 1, 12.1
512 Turn on tap, 2, 12.2
210 Place dishes in sink, 4, 12.4
435 Turn off tap, 5, 12.5

Is there a simple way renumbering the StepOrder entries when one step is totally removed to give me the following?

StepID, StepDescription, StepOrder, StepNumber
202 Put plug in the sink, 1, 12.1
512 Turn on tap, 2, 12.2
210 Place dishes in sink, 3, 12.3
435 Turn off tap, 4, 12.4

View 6 Replies View Related

Queries :: How To Sort Records By Grand Total Descending

Aug 9, 2013

I've recently been building a database on Access to replace the rather clunky and slow one we currently use here (built in Excel).Generally, I've been making it up as I go along which has worked quite well for me so far. However, I've encountered pivot tables. Normally, it shouldn't be a problem; the tables themselves are easy enough to understand. However, I've found that the tables aren't nearly as flexible as I would have liked. At least, not in a way directly apparent to myself.

(After trying, and failing, to include links to Imgur with details on my issue, I have included a .zip file with both images I was going to show)Generally, in Excel, the table works everything out for us, then we sort by largest to smallest and work out the totals for the last 7 days and the last 7-14 days (the week before last). After that, the last formula works out a percentage (loss or gain). [excel.png]

In the access table, though, I can't find a way to make this happen. There's no readily apparent button to add a new calculation field. I've tried using the create calculated total button, but that seems intent on making a separate total for each day on the table, which I don't want. [access.png]

Also, I can't figure out how to sort the records by grand total descending. I would have thought right clicking the grand total and clicking sort descending would have done it, but apparently that would be far too easy. I feel that it's prudent to mention that I'm not all that experienced with Access. I completed MOS and ECDL courses when I was in primary school, but it's been a really long time since that and all of the Office applications have changed rather dramatically.

View 1 Replies View Related

Forms :: Sort Listbox With A Button - Find Records In Database

May 3, 2013

I have a Listbox that I use to find records in the Database. It has two fields, [ShootID] and [ShootDate]. It is curently sorted in the query by [ShootID] but I want the user to be able to change it to sort by [ShootDate] and then back again.

View 1 Replies View Related

Reports :: Sort Records By A Calculated Percentage Using Text Box Values

Jan 27, 2015

So I have a report with the following text box controls:

[Surname] & ", " & [Firstname]
=Sum([Quarter1_A]) - Named "Quarter_Total"
=Sum([Quarter1_T]) - Named "Quarter_Target"
=Val([Quarter_Total])/Val([Quarter_Target]) - Named "%Target" (Percent Format)

The report is grouped by the expression '[Surname] & ", " & [Firstname]'.I am trying to sort the records by the %Target text box. I tried entering the expression into the sort function but it still sorts by the grouped expression. I also tried sorting by the name of the text box but got the same results. How can I sort by the desired control?

View 14 Replies View Related

Queries :: SELECT Records From A Table Based On IN Clause And Sort Them In Order

Jan 4, 2014

WinXPPro Sp3
Access 2007

After some research I thought I had found a neat way to SELECT records from a table based on an 'IN' clause and sort them in the same order as the values for the 'IN' clause... i.e.

Code:
SELECT Unique_No, Table_Name, List_Order FROM My_Table
WHERE Table_Name = 'Titles'
AND List_Order IN (3,1,15,4,5,12,7,2)
ORDER BY INSTR('3,1,15,4,5,12,7,2', List_Order)

Unfortunately, this returns list_order 5 just after 15 and list_order 2 just after 12, thus

List_Order
3
1
15
5
4
12
2
7

View 3 Replies View Related

Forms :: Form That Shows 100 Records At A Time - Filter / Sort Data Source Entirely

Oct 20, 2014

The recordsource is a query with over 6,000 records. The form currently lists the records in datasheet format with header and footer for things like buttons and filtering. The client wants to be able to go from page to page of the souce query, showing 100 records on the form at a time.

But at the same time, they should be able to filter or sort the data source in it's entirety. The person who created the form came up with what seems like an awful solution to the problem. It seems to use a random number generator to determine how many records to portray at a time. I see this in the code as well as in operation, because the number of records on page to page varies. It doesn't even start out at 100! Worse yet, using a sort on the page only sorts the records that are visible.

View 9 Replies View Related

Sort Subform Records On Numeric Values Stored In A Text Field On Main Form

Sep 25, 2015

I have developed a database but have had difficulty with sorting data within subform of a main form. The subform displays the related tasks that correspond with main form that has been selected. Within the main form I have also created a text field that defines a particular sorting sequence of the tasks found within the subform which is titled Task Sequence. What I would like to do, is use the Task Sequence field to sort the order of tasks within subform. I have tried: IIf([ID] Is Null, 0, Val([Task Sequence])) within the Advanced filter/sort but either it shows only the first task defined in the Task Sequence or it wants to filter the main form and not the subform.

View 14 Replies View Related

Sort Query

Jan 4, 2008

I have a query that has four fields. One is used only as a sort field. It works fine. However, if someone resorts the open query on one of the other fields (not the one used as the sort in the query), then inadvertently says “yes” to save when exiting, the next time they open the query, it is sorted by the field last sorted on, not the one set in the query

This is no biggie but just an annoyance. Any suggestions?

Thanks,
SKK

View 3 Replies View Related

Can I Do A Sort Within A Sort On Combo Boxes?

Oct 16, 2006

Hi all,

I have a form in Access 2K that properly displays city, state and zip codes. As I type in each letter of a city's name into the combo box, I get the first city in the sorted list displayed (autofills). That's fine when there is only one zip code for a city, but when I enter "chic" for chicago I still get the first chicago zip code in my table.

It sure would be nice if I could do a "sort within a sort" so that if there were two or more records with the same city name then that whole group would drop down so I could choose one of the other zip codes. If this is doable, kindly point me to an example as I need all the help I can get.

Thanks in advance for any responses.

D

View 6 Replies View Related

Complex Query Sort

Jul 19, 2005

I need to sort my query in a rather complicated way, and haven't been able to get the examples I've found on here to work.

I have the following fields
[Category]
[Name]
[Page]

Here is what I need.
Where [Category] = "Table of Contents"
Sort by [Name], Then by [Page] Descending
Else
Sort by [Name], Then by [Page] Ascending

All records will be queried at the same time, so "Table of Contents" categories will be included in the same query as other records, but need a different sort order. I know this is stupid, but leave it to government to impose some nonsensical rule on you.

Is there a way to do this?
Thanks,
Doc

View 4 Replies View Related

Sort Query Ascending

Aug 15, 2006

I have query that uses the following forumla "Team HCP2: ([Member Frt HCP]+[Member Back HCP]+[Guest Frt HCP]+[Guest Back HCP])/2" to calculate team handicaps. The formula performs as I need it to but when I try to check the sort box to sort "Ascending" it asks for a parameter.

All I want to do is run the query and have the results of the calculation field sort the column of results in a ascending order. All non calculated fields in the query are sortable by using the sort by ascending feature in the design mode.

Best regards,

Dave

View 14 Replies View Related

Query Doesn't Always Sort

Apr 27, 2007

Hello,

I have an access query that I run on a regular basis but that doesn't always sort. It sorts most of the time, but once in a while it won't, which makes it really annoying and impractical.

Does anybody know why this is happening?

Thank you.

The query is:

SELECT P.GEOSORT, P.TERR_CODE_IND AS TERR_CODE, P.GEO_CODE, P.GEO_DESC, P.PRODUCT_SHORT_NAME, P.M23VA, P.M22VA, P.M21VA, P.M20VA, P.M19VA, P.M18VA, P.M17VA, P.M16VA, P.M15VA, P.M14VA, P.M13VA, P.M12VA, P.M11VA, P.M10VA, P.M9VA, P.M8VA, P.M7VA, P.M6VA, P.M5VA, P.M4VA, P.M3VA, P.M2VA, P.M1VA, P.CMTHVA, P.M23VC, P.M22VC, P.M21VC, P.M20VC, P.M19VC, P.M18VC, P.M17VC, P.M16VC, P.M15VC, P.M14VC, P.M13VC, P.M12VC, P.M11VC, P.M10VC, P.M9VC, P.M8VC, P.M7VC, P.M6VC, P.M5VC, P.M4VC, P.M3VC, P.M2VC, P.M1VC, P.CMTHVC, P.M23VSAA, P.M22VSAA, P.M21VSAA, P.M20VSAA, P.M19VSAA, P.M18VSAA, P.M17VSAA, P.M16VSAA, P.M15VSAA, P.M14VSAA, P.M13VSAA, P.M12VSAA, P.M11VSAA, P.M10VSAA, P.M9VSAA, P.M8VSAA, P.M7VSAA, P.M6VSAA, P.M5VSAA, P.M4VSAA, P.M3VSAA, P.M2VSAA, P.M1VSAA, P.CMTHVSAA, P.M23VSAC, P.M22VSAC, P.M21VSAC, P.M20VSAC, P.M19VSAC, P.M18VSAC, P.M17VSAC, P.M16VSAC, P.M15VSAC, P.M14VSAC, P.M13VSAC, P.M12VSAC, P.M11VSAC, P.M10VSAC, P.M9VSAC, P.M8VSAC, P.M7VSAC, P.M6VSAC, P.M5VSAC, P.M4VSAC, P.M3VSAC, P.M2VSAC, P.M1VSAC, P.CMTHVSAC INTO SORTED_P
FROM P
ORDER BY P.GEOSORT, P.TERR_CODE_IND, P.GEO_CODE, P.GEO_DESC, P.PRODUCT_LOGICAL_ORDER;

View 6 Replies View Related

Duplicate Query, (sort Of)

Oct 11, 2007

I need to create a query for an error report.

What I need is a query that will find any duplicate records from field '1' in my table.

But then I want it to check another field '2' in the same table for any records that meet criteria 'A' but also have entries with a different critiera.


Not sure if I'm explaining that right.

So say we have a table like this

field 1..........field 2
XX.................A (the criteria we want)
XX.................C (oops, somone entered another entry with a different criteria)


So it would tell us that the 'code' in field 1, we have the criteria A and C at the same time. not good.

I hope that makes sense.

View 14 Replies View Related

Sort Query By Month

Jan 14, 2008

I have made a query where the user have to enter from date and to date, and the result will be between these dates. If I write, lets say, from 01.01.2008 to 29.02.2008 It brings the results for all entrys between these dates, But I wonder if it is possible to make two results for that one, one for january and one for february. (All in one query, just sorted after month) Or maybe in the report perhaps. But I have no idea if this is possible, or how to do this. I know how I can sort it after date with the same query, but I want the results per month. Would be very nice if I can get it listed in a report, so that I can print out one page with results for january, february, march etc.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved