Append Queries - Sorting Issue

Apr 11, 2007

Hi,

I have a macro that runs a 'make table' query followed by a series of 'append queries' each time the macro is called. I require the data from each append query to be pasted below the existing data already created by the original make table query and the append queries that have already run. The issue that I am having is that the data in fact appears to be appended in an unpredictable way (ie sometimes I run the macro and find that data from the append queries is below the data from the make table query, at other times I run the macro and find that data from the append queries appears above the data from the make table query. Unfortunately, this causes problems with downstream queries, which rely upon finding the last row of data subject to various filters. Can anyone help me understand how Access determines the sorting/positioning of new data appended to an existing table, and therefore resolve this issue?

Thanks in advance,

jc

View Replies


ADVERTISEMENT

Queries :: Sorting Groups Of Zip Codes

Oct 14, 2013

I have a query that will sort groups of zip codes using the following expression: Between [T_ZipRange]![StartZip] And [T_ZipRange]![EndZip]. The first and last zip codes are entered and the expression returns the zip codes between the "start" and "end" range. The problem is that if a zip code is only 5 digits: xxxxx- instead of xxxxx-xxxxx, the zip code will show up in other sorts. The zip code field is a text field. How can I limit the sort, based on the number of digits in the zip code?

View 2 Replies View Related

Queries :: Sorting A Field Within A Query?

Feb 5, 2014

I have a query that pulls info from a table. One of my fields is frequency and in that field i have weekly, annually, daily, etc.

How can I make the query sort starting at the daily one and move out to annually?

View 2 Replies View Related

Queries :: Sorting A Query In Unconventional Way?

Aug 1, 2015

I want to sort the results of a query as follows.

The query returns 4 fields
ID, Field1, Field2, Field3

For the first 500 rows I want to sort by Field1 with the remaining rows sorted by Field3.

I can identify the first 500 rows bi ID being less than 501.

I've done something similar where I've displayed a value of a field in a different order by coding something like

ORDER BY Iif([field3]=9, 0.5, [field3])

which sorts the 9's first followed by the rest in ascending order but can't work out what to do here.

View 14 Replies View Related

Need Help Fixing Sorting Problem Using Nested Queries

Dec 6, 2006

I have a set of two queries (which I'll call A and B, for convenience). Query A reads a table containing customer order numbers, a sequentially-assigned line number for each item requested by a customer on a particular order, and a part number associated with each order line. The line numbers are not integers, but run out to three decimals - so 1.000, 1.100, 1.150, 1.200, etc. would all be valid line numbers. All Query A does is to sort the table, with the primary (first) sort being order number, and with line number being the secondary (2nd) sort. Each record also contains a field equal to the integer value of the line number, so for lines 1.000, 1.100, 1.150, 1.200, this third value would always be 1; similarly, for lines 2.000, 2.100, and 2.200, the third value would be 2.

Query B uses query A as its source of input, and performs grouping (using the "Group By" function) so that query B's output displays only one record for each unique combination of customer order number and INTEGER line number; the part number displayed on each row of query B's output is supposed to be the part number on the first row of query A's output whose order number and integer line number correspond to each group in query B. (I am using the syntax of "First(Part Number)" in query B to report this.) This seems to be working most of the time, but not consistently; sometimes, for each unique order number / integer line number combination, Query B reports a part number from the wrong row of Query A. So, for example, order 12345, integer line 1, as reported from query B, may report the part number on line 1.300 from Query A, instead of line 1.000 from query A as intended.

Does anyone know a fix for this? I've got a team of anxious coworkers who are hoping for it.

Thanks a lot!

View 1 Replies View Related

Queries :: Sorting Month / Year Within A Crosstab?

Jul 7, 2014

I have a crosstab where I want year and month in the header so I have formatted a variable MTHYR to be of the form mm/yyyy.

This works well as Access only wants one variable in the column header. My problem is that it is not sorted nicely and with my data being between Aug 2013 and Jun 2014 the headers look like this.

1/2014,10/2013,11/2013,12/2013,2/2014, not a very nice order.

Is there a way I can reformat MTHYR or a completely different solution?

My current code is

Code:
TRANSFORM Count(VOR_CALD_REGION.[Case Number]) AS [CountOfCase Number]
SELECT VOR_CALD_REGION.[Dealer Name], Count(VOR_CALD_REGION.Case Number]) AS [Total Of Case Number]
FROM VOR_CALD_REGION
GROUP BY VOR_CALD_REGION.[Dealer Name]
PIVOT VOR_CALD_REGION.MTHYR;

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 :: Sorting - Show Records From This Week Only

Apr 23, 2013

I'm doing a query and I want it to show records from this week only.

Is there a formula I can use in criteria?

View 3 Replies View Related

Queries :: Sorting Date From DateTime Field

Jan 27, 2015

I have a field on a table that is a DateTime format and it needs to be that way. I am trying to query that table for all the dates to use in a combobox but I only wat the date not the time. The problem is when I format the field to just date I can't sort it anymore as a date and I can't group them. I still get multiple lines in my combobox because there multiple times for the same day. what is the proper way in a query to extract just the date from a field and still sort it as date ie 1/12/2015 is greater than 12/15/2014?

View 8 Replies View Related

Sorting A Table, Apply The Sorting To A Form

Mar 10, 2006

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)

View 5 Replies View Related

Reports :: How To Combine Queries Into A Summary Query Of Sorting

Mar 21, 2013

i intially, I wish to have attendance stats for 3 groups of people over 2 days in a report

i have the two queries for the raw data, but wish to combine into a report that will ultimately become a "dashboard" report for half a dozen queries., and can only get one or the other to work do i need to combine the queries into a summary query of sorts?

View 1 Replies View Related

Queries :: Complex Query Sorting And Summing Amounts Breakdown

Jan 28, 2015

I have a shell of my database in the below link for reference. I am trying to create a query for a report that will allow me to track charges and payments per client. Each charge has a ChargeID and each payment has a PaymentID. Multiple payments can be applied to one charge so the same ChargeID can show up multiple times with a different PaymentID. Payments that are catagorized as Third Party Payments will have not only a PaymentID, but a TPPaymentID.

What I need to do in the query and final report is track the total charges (even though the ChargeID may show up multiple times, I only want the charge itself to be calculated once and the charge to only be listed once for each client) and track the total payments as well as sum the total payments for each charge for each client.

View 9 Replies View Related

Update Queries Vs Append Queries, Indexes?

Aug 7, 2007

This is a very simple problem most likely for the masses, but I am new to access. I have employees who enter will enter information about specific tests on electronics components into separate tables by a form. I know my method is poor, but this is how it works. I got assigned this database at my internship this summer because they ran out of thigns for me to do.....I've never even used access before, so as long as it works, they're happy. I have a form which which writes to a first table with 20 fields. I then have separate update queries which take the data in the first table and put it in all the other tables. Trust me, i know this is pretty much the opposite of the whole point of a relational database, but I am and was limited by time, for the size of the database they want, there was no time to learn about normalization etc etc. Sorry this is wordy, but THE QUESTION is......if they run multiple tests wtih the same information for some of the fields I have fields named "Run#, Unit#, Date" etc, even if there is records wtih the same information, hwo do i get it all to show. Right now, it seems to be rewriting over the same records. If they run 3 tests on unit 10 on August 1st, how do i get it so all those show up. I think its somethign wtih in the table, for the primary keys, changing the Index: No, Yes(Duplicates) Yes(No Duplicates) but I could be way off. Thanks, if the question doesnt make sense i'll try to rephrase it, I apologize I'm running on about 45 min of sleep:confused:

View 3 Replies View Related

Queries :: Append Only Last Row

Jul 12, 2013

I have an append query and want only the last row (Unique ID) to be added rather than the whole table. Is it do-able? Here is the SQL...

INSERT INTO TblCoursesRebooked ( StaffCourseID, Course, [Date], Staff, [Renewal Date] )
SELECT TblStaffCourse.StaffCourseID, TblStaffCourse.Course, TblStaffCourse.Date, TblStaffCourse.Staff, IIf(IsNull([Renewal in Years]),Null,DateAdd("yyyy",[Renewal in Years],[Date])) AS [Renewal Date]
FROM TblStaffCourse INNER JOIN (QryCourses INNER JOIN TblCourse ON QryCourses.CourseID = TblCourse.CourseID) ON TblStaffCourse.Course = QryCourses.[Course & Level]
GROUP BY TblStaffCourse.StaffCourseID, TblStaffCourse.Course, TblStaffCourse.Date, TblStaffCourse.Staff, IIf(IsNull([Renewal in Years]),Null,DateAdd("yyyy",[Renewal in Years],[Date]))
ORDER BY TblStaffCourse.StaffCourseID DESC;

View 4 Replies View Related

Update/Append Queries

Sep 19, 2005

Just wondering if someone can point me in the right direction so that i can solve my problem?

Basically what i have is a select query that carries out some calculations based on data entered. These calculations are expressions as i am sure you guys know. what i want to do is put the value from the expression/calculation into my table in the correct fields made for these values. However i have tried everything i can think of to get this data into the tables fields but to no avail.

example. Expr1: [field1]*[field2] the answer created by [Expr1] is the value i want to be placed in [field3]

Can anyone help me on how i can do this

View 4 Replies View Related

Append/delete Queries

Sep 23, 2007

I got these two append and delete queries in my database that i want to run on startup. I was wondering if there is a way to not have the msg that pops up to ask if you are sure you want to append/delete 0 record to table if there isn't any record that matches the condition set. I'm sure there is a way because if there isn't any record that matches the condition set in the queries then i don't want to have to click "No" everytime the database starts.

thanks,
Vincent

View 14 Replies View Related

Criteria In Append Queries

Nov 11, 2004

I have a table that I want to append to another table, but I do not want to duplicate records if the check number is already in the table I am appending to. I have tried
<>[deposit].[check_number]
or
not like [deposit].[check_number]
or
not [deposit].[check_number]
but I always get prompted to enter a check number... therefore the criteria statement not working.
do not know what I am doing wrong.

View 5 Replies View Related

Select And Append Queries... At The Same Time?

Oct 10, 2007

I've done some searching, and haven't found any threads that match what I am attempting...

I have a database that tracks expenses that are incurred under different ongoing projects. I currently have a report based on a query that asks the user for the project number, and shows all the expense invoices that have not been paid for that project. This report is basically an internal invoice that gets assigned to a department, and so it is assigned an internal "invoice" number. Currently, the user types in this internal number before the report is generated and it is displayed on the report for printing purposes.

Here's the tricky part (for me anyways): I would like to be able to filter the invoice records by project number, and then append the user-entered internal invoice number to the applicable records. There is already a field in the table for this data, and it is currently being entered on individual records after the report is printed. My goal is to be able to do this all in one step.

Any help will be greatly appreciated... Thanks guys!

View 14 Replies View Related

Queries :: Key Violations With Append Query

Feb 14, 2014

I am having fun with key violations and cant seem to find out why?

I basically am deleting a Job but when i delete it i want to archive it hence the 'Archive' query and the History Tables.

It seems to be pasting everything in fine apart from the 'EmpJobHistory' Table?

I am getting the usual message "Key violations"?

I think i need the intermediate 'EmpJobHistory' Table because there will be Employees that are related to many Jobs and vice versa.

View 9 Replies View Related

Queries :: Append Query Where A Condition Has To Be Met

Feb 26, 2014

I am trying to copy notes from one table to another table where a condition has to be met and I can't figure out how to do that in an APPEND query.

Each record has a unique number that comes into my Initial Table in my Access database from a construction program I download. In this particular table both the [DNJTNo] and [DNVersionNmbr] fields can have duplicate numbers. However, when I run the query I want it to add a record to the second table only after the query checks that the [DNJTNo] in combination with the [DNVersionNmbr], is not already in the table. If it is, I do NOT want it appended to the second table. (I have attached a picture of the query in APPEND design stage).

View 2 Replies View Related

Queries :: Append Data To Table?

Apr 20, 2015

I have a table called dbo.userinfo with a primary key called employeeid and a field named jobfunction.

i have an intermediate table named dbo.projectpositions with a primary key named projnumber and a foreign key named employeeid.

I have a 3rd table named projects with a primary key projnumber and a field called project manager.

I'm trying to append the Projects table so that any projects that a worker has worked on (dbo.projectpositions) that is listed as a project manager (jobfunction) will have their employeeid fill in the project manager field on the projects table. Looks something like this:

INSERT INTO Projects ( [Project Manager] )
SELECT dbo_UserInfo.JobFunction
FROM (dbo_UserInfo INNER JOIN dbo_ProjectPositions ON dbo_UserInfo.EmployeeID = dbo_ProjectPositions.EmployeeID) INNER JOIN Projects ON dbo_ProjectPositions.ProjNumber = Projects.ProjNumber
WHERE (((dbo_UserInfo.JobFunction)="Project Manager"));

But just can't figure out the next step to populate the project manager field...

View 2 Replies View Related

Queries :: Append Query - Only New Records

Aug 15, 2013

How can I modify the below code so that it only adds new records to AttributesTBL from ProductInformation-Consumer?

INSERT INTO AttributesTBL ( Material )
SELECT [ProductInformation-Consumer].Material
FROM AttributesTBL INNER JOIN [ProductInformation-Consumer] ON AttributesTBL.Material = [ProductInformation-Consumer].Material;

View 2 Replies View Related

Queries :: Run Append Query N Times

Jun 10, 2014

I have a table with 3 fields:

numberFROM, numberTO, Quantity

e.g.:
10, 15, 6

I would execute an append query that will store in another table:

10
11
12
13
14
15

How could I mange it?

View 14 Replies View Related

Queries :: Append Using Table Data

Jul 25, 2013

I basically want to use a set list (TableAddresses). This would be a Append Like "*InsertAddress*" I do this manually by simply typing 20 different addresses and then clicking Append.

Is there a better way to do this simply?

View 1 Replies View Related

Queries :: Append Query Error

Apr 27, 2014

I am having problems adding details from StudentForm to student table. When I click on the add student button it throws back an error Microsoft Access cant append all the records in the append query.I have attached the error as a pdf and the database for info.

View 2 Replies View Related

Forms :: Append Queries On Form

Apr 19, 2013

I have a form(frmNewTest) that generates a fitness test id when you enter the month and year (you do not need to enter anything in the Fitness test id field which is greyed out).

This data on the form should then append to the tblFitnessTest. However, when I select the button to add test it returns a message 0 rows to append.I have attached the database and the form in question (frmNewTest). There are two append queries attached to the button on the form and neither work correctly. I have tried almost everything but can't get it to work.

View 4 Replies View Related







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