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 Replies


ADVERTISEMENT

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

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

Queries :: Sort By Year Is Sorting By Month

Sep 16, 2013

I've created a query based on 2 other queries.

I then filter the results of the third query based on 2 dates.

This worked great for 2013.

As a test I started making some records for 2014 and I've now found that my third query is not filtering the dates properly.

The filtering is happening based on date fields that contain only month and year eg: "09-2013".

My problem is that when I try to filter for records in 2014 it brings up results for 2013 as well.

If for example I had a record in August 2013, September 2013 and August 2014.

The sort would be:

08-2013
08-2014
09-2013

NOT:

08-2013
09-2013
08-2014

How do I make the sort apply to month then year to get the correct results returned?

View 6 Replies View Related

Queries :: How To Show Records Based On Date

Nov 8, 2013

I have a form where someone enters a 'Job' to be done which in turn creates a record in a table with all this information

On the form I have a field called 'Repeat Frequency' where the user can choose how often they would like this 'Job' to repeat. e.g. Monthly

Then, on another form someone else can check what 'Jobs' should be done on that day

I have managed to get this to work fine using the DatePart function and it displays all jobs to be done that fall on the current day (e.g. if they choose to repeat it weekly, it will look for all entries where the datePart "d" [DateToBeDone] = Date()-7, -14, -21 and -28)

The problem is that i have been limited to the options of 'repeatability'

What i would like to do is change the options from 'Weekly', 'monthly' etc and instead have a field makrked "Repeat every so many days"

Is there a criteria i can use in a query where i can show records every so many days? i.e. if there is a job in the system that should repeat every 7 days and the [DateToBeDone] is set to 31/10/13, it would return this record on 07/11/13, 14/11/13, 21/11/13 and so on?

I Have tried DatePart ("d", [DateToBeDone]=DatePart ("d", (Date()-[RepeatDays] but what happens is it only shows it if the day is that many number of days in the past and not multiples as i said above.

View 7 Replies View Related

Queries :: Sort Order In Query Based On ID (Autonumber)

Sep 10, 2013

This is something I occasionally see in Access and has been bugging me for quite a while.

As an example, when I have a table (all text fields except for the ID field which is an Autonumber with a unique index - ie just what Access creates when you import data) and I try to make a new table from a query by indexing the Autonumber field in descending order (ie to reverse the order of the table), it doesn't work properly.

So if I have:

SELECT [mytable].* INTO [mytable sorted] FROM [mytable] ORDER BY [mytable].[ID] DESC;

When I preview the data (ie run the select query to have a look at it), it looks fine.

When I change the query to a 'Make Table' and I then I check the table it makes, the order changes part-way down the list, so looking at the ID field it runs from number 2669 down to 2087 correctly, then it goes from 1960 to 1956, then 1803 to 1799, then 1751 to 1747, etc etc etc. After a while it seems to correct itself again, and orders normally down to #1

I'm using Access 2002.

View 5 Replies View Related

Queries :: Query To Return Records For A Given Year

Feb 3, 2014

I'm trying to create a query to show me records for a given year. The issue I'm having is that each record has (4) dates fields and each record can contain null values.Is it possible to do this in a query with data like the example below?

Field 1 ID (1), Field 2 Date (12/22/2012), Field 3 Date (2/06/2013), Field 3 Date (Null), Field 4 Date (Null)

In this example I would want 2013 data but would need to be able to search any year. I could also have dates in all (4) fields

View 3 Replies View Related

Show Records In Query Based Off User Input In Form

Nov 3, 2005

Ok this might be basic stuff i'm a bit dumb

I have a query showing lots of records of equipment that is in different rooms. I would like to have a form where the user can bash in a room number and all the records from the query that have that room number in it pop up.

Please help the dumb

View 3 Replies View Related

Queries :: Query To Run Before Report Based On Criteria Based From Two Combo Boxes On Form

Mar 20, 2013

I have a report that gets its data from a query. I need the query to run before the report based on criteria based from two combo boxes on a form.

View 3 Replies View Related

Queries :: Query To Show Field Based On Last Record ID?

Sep 4, 2014

I am looking to get a query to show my list of customers "Grouped By" [CustomerName], that show only the single [CurrentBalance] field for each customer based on the "Last or Highest" [RecordID].

Also, each customer can have up to 4 different [StockType]'s but at least 1 [StockType].So my results would look like this:

[CustomerName] - [StockType] - [CurrentBalance]
Customer#1 StockType#1 5

Customer#1 StockType#2 4

Customer#2 StockType#1 5

Customer#3 StockType#1 5

View 6 Replies View Related

Queries :: Differentiate A Query Based On All Group Records Or A Query Based On Only One Record

Dec 22, 2014

I have a combo named cbogroup. I have a tblGroup with several records (active, non-active, nursery, etc.). One of the records is *ALL*. Using the CboGroup the user can pick any of the records. Howeverr, if they pick the *ALL* record, I want the query to pull up animalID based on all records in the TblGroup. If another record is picked (i.e. nursery), then the query will pull up only animalIDs that are in the 'Nursery'.Can I put a (iff then) in a query in order to differentiate a query based on all group records or a query based on only one record?

View 14 Replies View Related

Queries :: Append Query For Recurring Invoices?

Jul 7, 2014

I am looking to make an invoicing database.

I create 30 invoices a month. each client gets billed the same amount each month (for example Customer A gets billed $100 every month, Customer B gets charged $200 each month). Only two things get changed on the invoice-'Description' (for example the description would be 'services rendered for July 2014' for July invoice) and 'Invoice Date'.

Now please see the image attached, I have an append query that combines information and creates invoices for all 30 clients.

The problem is, the 'Invoice No' field in the invoice table stays empty, because I do not know how to start numbering at a specific point (for example invoice numbering should start at 14150001) and I want it to add the number (+1) automatically when this append query adds data to the invoice table.

View 13 Replies View Related

Show Me The Last 4 Invoices For Every Customer

Aug 5, 2005

I have a table with every invoice I have raised to my customers on it (160,000 records so far). Every record identifies the customer and the date of the invoice. I would like a query that returns details of the last 4 invoices raised to each customer based on the date of the invoice. So, if I have 100 customers I would expect 400 records returned. I have spent ages searching and reading the forums re this and have seen several post that I "think" are similar, but I think I'm too daft to understand the solutions put forward. I "think" this involves a module to count but as I have never written a module in my life am a bit confused. Any pointers would be greatly appreciated.

View 7 Replies View Related

Multiple Combo / List Boxes - Sort Based On Entries

Sep 23, 2013

I am trying to put together a form where employees will be entering maintenance information into my database. One of the requirements for this data is that when they perform repair work on an asset, they have to list a problem, cause and remedy. These are codes that are specific to each asset.

The closest thing I can think of to what I am trying to acheive is the selectors on car search websites. You select a MAKE, and then the MODEL list is narrowed down based on that, then you pick the TRIM, which is narrowed down based on the model selection. I have an Excel spreadsheet of the Assets(Failure Class), Problems, Causes, and Remedies...I'm just not sure how to put this into Access to get the desired output. I have attached a sample of the Excel spreadsheet for illustration.

I believe I'm going to have to put each of the columns in a seperate table and use relationships..but I'm not sure about that.

View 2 Replies View Related

Modules & VBA :: Query To Compare Values To Show All Records Where Form Combo Value Is Selected

May 1, 2014

I am building a tracking database where we would be able to track information which field are null data and report them to our Administration to fill the null data. For this I have created a form name "Search" and I have a combo box control on that form which is bound to "Table = employee" and its ROW SOURCE TYPE="Field List", I would like to able to query records where the selected value in this combo box is null through out the table.

For example if I select "Telephone" from this combo box dropdown, I would like the query to show all the records where the "Telephone" is null, how to set the criteria in query to take the combo box value as "Field Name" and then compare it with the Field/Column in the table and show the null values.

View 4 Replies View Related

Queries :: Only Show Records That Do Not Appear In Another Query

Jul 30, 2013

Currently I have a query, QRY_Test which contains a load of records under the fields "Gift_ID" and "Person_ID". I have another query, QRY_PersonList in which I would like to show all of the "Person_ID"s except the ones returned by QRY_Test.

View 3 Replies View Related

Queries :: End Of Year Age Based On A Date

May 15, 2014

I have a date of service [DOS] and a date of birth [Birth Date]

I'm trying to calculate the age at the last day of the date of service year not the current year.

Example:
[Birth Date] = 6/25/1993
[DOS] = 10/18/2013
Age at the last day of the date of service year (12/31/2013) = 20

How to do this. I tried

Code:
DateDiff("yyyy",[BIRTH DATE],[DOS])+Int(Format([DOS],"mmdd")<Format([BIRTH DATE],"mmdd"))

but this does not work correctly.

View 8 Replies View Related

Queries :: How To Sum Field Based On Every Year

Jul 2, 2015

I tried writing a SQL query to produce the list of details in year wise DESCENDING order for the input - Agent ID.

In addition to that I need to get the sum of amount fields year wise in the report. How to achieve it???.

Find the attached report for better clarification.

First three column in the attachment is the outcome of the below listed query. Whereas the fourth column is the expected result which needs to be included..

Code:
SELECT CessioneCredito.Data_Movimento, CessioneCredito.Anno, CessioneCredito.Importo FROM CessioneCredito
WHERE (((CessioneCredito.ID_Agente)=[Reports]![R_StoricoCessCredAg]![ID_Agente]))
ORDER BY CessioneCredito.Data_Movimento DESC;

How to alter the code in order to provide the SUM of Importo field every year.???

View 3 Replies View Related

Queries :: Show Data - Query Based On User Selected Time And Date Range

May 17, 2013

I have a form that request information from the user (StartDate, StartTime, EndDate and EndTime) the problem is that it's not working. The only way I can get any data to show is when I remove the StartTime and EndTime. Only then will it pull the items from the StartDate and EndDate.

Here is what I have as my criteria: Between [Forms]![OpPROD_ALL]![StartTime] And [Forms]![ OpPROD_ALL]![EndTime] And Between [Forms]![ OpPROD_ALL]![StartDate] And [Forms]![ OpPROD_ALL]![EndDate]

The users will be able to request a report based on a start and end date along with a start time and end time.

Side note: this is to pull date for 3rd shift (Example) 4/14/2013 10:00PM - 4/15/2013 10PM

View 1 Replies View Related

Year And Date - Show Day Of Year As Three Numbers

Jan 10, 2012

I'm going to try using the year, day of year, hour & minute (24 hour clock) as a report number. It's set up in a field on a table. Right now I have....

Default Value =Format(Now(),"yyyhhnn") 'which works but not exactly how I would like

yy = Last two digits of the year
y = Number of the day of the year (1 to 366) 'can this show three digits all the time?
hh = Hour in two digits (00 to 23)
nn = Minute in two digits (00 to 59)

For instance, right now for Jan. 10th, 2012, 1306 hours the result would be 12101304 which, for all intents and purposes works, but I would prefer the "day of the year" to always be represented by three digits and not just when it hits day 100 of the year.

I would prefer to see 120101304

View 4 Replies View Related

Queries :: Query To Show Only Records With All Parts Received

Apr 10, 2015

I would like to create a query to show only the Work Orders that all parts ordered have been received.For the Work Order, each part ordered has a "complete" yes/no checkbox.If I use that field in the criteria of the query, it does return only parts that are "complete." However, it still shows me a Work Order where there are parts ordered but not received "not complete." how to set the query to exclude those cases and only return Work Orders that all parts ordered on the Work Order are received "complete."

View 3 Replies View Related

Queries :: How To Set Rolling Year Based On Individual First Record

Mar 31, 2014

I wanted to know if it is possible to set a rolling year based on the first recorded date for an individual. In other words, my table is updated every time an employee receives a point. The record includes the employee's name (empName), the date (dateOfOccurrence), and the point (occurrencePoint).

I would like to create a query that would be based on a rolling year from the very first record of an employee based on the first dateOfOccurrence. The first date/record of this employee would be the start of the rolling year. I am writing this in SQL in Access 2013.

View 1 Replies View Related

Reports :: Access 2003 / Report Show Items From Previous Invoices?

Apr 15, 2013

I am building a replacement Access 2013 database for our ageing Access 2003 database. I have an invoice form with a subform with a combo box that allows me to select which jobs to invoice based on the customer selected in the invoice form, which is working fine. I have designed my invoice and have the criteria [Forms]![Invoice]![ID] in the report query so that it just selects the record that is open in the invoice form. I have an ID (which is the invoice number) group on the report and it is then sorted by date and then job number. I thought it was all working fine when I tested it, it is the same method as I used in the 2003 database. However I have a problem, when I make up and print the customers first invoice it works fine, but when I go to make up a second invoice for the same customer the invoice includes all the jobs from the first invoice as well, and if I then go to reprint the first invoice all the jobs from the second invoice as there as well.

View 1 Replies View Related

Queries :: Left Join Query To Show Records That Fulfill Two Criteria

Mar 25, 2014

I have two queries. The unique key in both queries is GUID for katalogposition.

One is showing me records which has an product end date (Produkt slut dato) between today and end date of next month. This query works fine and is called q_termination.

The second one shows me unmatched records in the first query (q_termination). The query works fine and is called yq_NonTermination.

The goal is now to show me records from the first query "q_termination" that fullfill one of two criterias.

1. No match in second query "yq_NonTermination"
2. Match BUT product end date (Produkt slut dato) is greater than the match in "yq_NonTermination".

I have made a left join query on the field "Dublet_Lagervarer". From the join query the goal is to show me only q_Termination.Guid for Katalogposition number 47 and 134008.

How can I do that? Is there another way to do it? Please see attachment.

View 3 Replies View Related

Queries :: Calculate New Fields Based On Current And Prior Year-end Numbers

May 6, 2013

I am creating a Make Table Query and calculating new fields based on current and prior year-end numbers. If the prior year-end number does not exist (Is Null), I want the use the current rate or calculate the change in rate. I have typed the below in the Field Box:

CHG_IN_PGM_RATE: IIf(([P0_10 Tbl - AM PYE PTD Detail w Rates]![PTD_PYE_PGM_RATE]) Is Null,([MASTER LIST CURRENT]![PTD_PM_PGM_RATE]),(([MASTER LIST CURRENT]![PTD_PM_PGM_RATE])-([P0_10 Tbl - AM PYE PTD Detail w Rates]![PTD_PYE_PGM_RATE])))

However, when running the query, I get the attached error message.

The screenshot will also show how the two tables are joined.

View 2 Replies View Related

Queries :: Use Switch In Query Criteria Based On Combo Box

May 15, 2013

On I form I have a combo box called cboMobileStatus.Its row source type is "Value List".The row source is: 1;" All";2;"Has";3;"None".I have a query based on table "tblCustomerContacts" and I want to limit the records returned based on the value of the combo box.So if the user selects:

* All (1) I want all records returned.
* Has (2) I only want records that have a mobile number returned
* None (3) I only want records that do not have a mobile number returned

The field mobile is text (to keep the leading 0)I thought of using the Switch function in the criteria of the query for field Mobile like this:

Code:
Switch([Forms]![frmPrintCustomer]![cboMobileStatus]=1,([tblCustomerContacts].[Mobile]) Like "*",[Forms]![frmPrintCustomer]![cboMobileStatus]=2,([tblCustomerContacts].[Mobile]) Is Not Null,[Forms]![frmPrintCustomer]![cboMobileStatus]=3,([tblCustomerContacts].[Mobile]) Is Null)

but the query does not like it!Am I on the right track, and if so, how should I modify the code?

View 2 Replies View Related







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