Queries :: Sort By User Input Order
Apr 30, 2013
I have a simple form with a text box, I enter a series of part numbers separated by newlines, and then I use the following code to query for each of the separate part numbers:
Code:
Dim strSql As String
Dim part_nums() As String
Dim num As Variant
Dim multivar As Boolean
multivar = False
[Code] ,......
This all works perfectly, but what I need to do is have the query return the records in the same order I entered the part numbers. They are automatically returned in alphabetical order by item_no, and when I enter 15+ part numbers it becomes slightly difficult to search through them all on the form to find the one I am looking for. It would be a lot easier if they were output in the same order that I type them in. Is there any way to make this happen?
View Replies
ADVERTISEMENT
Jun 21, 2013
My table have orderid along with other columns, i want to create a form where i am having a textbox for order id input by user. Firstly when user sees the form its only with the textbox and table fields, when i put the order id in the textbox the listing should be made.
View 1 Replies
View Related
Mar 28, 2013
I have a table with product numbers and their cost. That table has 3 fields : SKU, Cost, Month. (The cost can change every month, therefore the list is built to have a cost / month)
I want the user to be able to input the data in the table using the form but I would like the form to be sorted Alphanumerically for the SKU numbers and then per month (in their normal order not alphanumerically).
I have a combobox (named month for testing purposes) to force the user to select one of the 12 months and the field type is Text.
Also I am unsure how to "autosort" (or apply a permanent sort) the form whenever it's opened. Will it be applied if I just set the sort and then restrict the user from seeing let's see design mode?
View 4 Replies
View Related
Sep 13, 2013
I have a query that is returning running conditions for a machine over multiple shifts. the table is set up like this
Code:
date shift parameter condition
09/13/13 1 front 500
09/13/13 1 middle 450
09/13/13 1 back 475
09/13/13 2 front 510
09/13/13 2 middle 460
09/13/13 2 back 490
this is just a small example. there are about 24 different parameters reported on in a shift..I want the query to sort by date ascending, shift ascending, and then by parameter in a specific custom that i define. I want it ordered "front, middle, back" for each shift. Again this is just an example, there would be 24 parameters I want in a specific order. Then do I need to define the sort order again for the report based on this query?
View 3 Replies
View Related
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
Apr 22, 2013
I have a query with a float/delta column which is the expression:
Code:
Float: [Date1] - [Date2]
When I try to change the order by in the column filter drop-down i get a data type mismatch in criteria expression error.
View 1 Replies
View Related
Feb 28, 2014
I have a table with multi columns with unsorted data.
I want to run query to sort data in multiple columns.
How can i do it?
View 1 Replies
View Related
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
Sep 10, 2013
I have a database table in which I'm trying to pull sales data and generate sales reports from. The problem I face is that the sales data is recorded into a table with this structure:
Year | Customer | Sales_Month_1 | Sales_Month_2 | Sales_Month_3
Rather than having a single field "Month" in which I could set criteria or prompt the user to select a month to derive sales data from, I need to write a query that through user input (or through some code within the query) the right field will be selected. An example of this would be generating a report for the 1st month of the year, obviously.
View 1 Replies
View Related
Jul 29, 2013
I have a cross tab query that takes input from the user. The code is as under:
PARAMETERS [START_MONTH] DateTime, [END_MONTH] DateTime;
TRANSFORM Round(Sum(([A_GAS_m3]+[NA_GAS_m3])/1000000),3) AS GAS_MMSCM
SELECT maindata.on_off, maindata.state, maindata.OPERATOR, maindata.field_block
FROM maindata RIGHT JOIN PRODUCTION ON maindata.field_block=PRODUCTION.FIELD_BLOCK
WHERE ((PRODUCTION.MONTH) Between Format([START_MONTH],"dd-mm-yyyy") And Format([END_MONTH],"dd-mm-yyyy")))
GROUP BY maindata.on_off, maindata.state, maindata.OPERATOR, maindata.field_block
ORDER BY maindata.on_off, maindata.state, maindata.OPERATOR, maindata.field_block
PIVOT PRODUCTION.ACTIVITY;
I am facing 3 problems with the above code:
1. Access prompts to enter the start month and end month even when I click the save button.
2. When I run the query it prompts to enter the start month and end month twice.
3. I have generated a report based on the above query. When I run the report it keeps on prompting for start month and end month and does not give the final result.
Is it a common problem with cross tab queries?
View 5 Replies
View Related
May 26, 2015
I have a crosstab query. users need to run the query for any week of a year. It is always a YTD query. I have used this process on many select queries. Will a crosstab query not support this simple method? See attached screen shots.
View 2 Replies
View Related
Oct 14, 2013
I have created a query with the parameter for the Domain field. however on the form the user enters this information via a drop down menu. i was just wondering could the parameter box be set to a drop down box as well to save the user entering in the full Domain field name?
View 6 Replies
View Related
Oct 10, 2005
How do you change a file's sort order from ascii to international?
View 3 Replies
View Related
Feb 11, 2007
Hi all, I am new to this site and I am hoping that I might be able to get some help with my database which records address information of people reqesting a brochure or making a hotel booking. The problem that I am having is that the addresses are sorting in post code order, I have selected remove filter/sort and this does not do anything. I would like the records to stay in the order that they are entered at I also use this for a merge with a brochure/deposit letter and it is much simpler if I can merge a block of entries.
Many thanks in advance Pat.
View 6 Replies
View Related
Apr 18, 2007
Supposed I have the following tables:
TableMonthlyReport consists of the following fields:
*IDStore
*Year
*Month
*IDCatalog
*IDItem
Quantity
TableGoods:
*IDCatalog
*IDItem
ItemName
IDSupplier
The asterisks indicates the index keys. While TableMonthlyReport has 2 links of relationship with the TableGoods on IDCatalog and IDItem.
I have a data entry front end for monthly report. I have no problem to have the record source for this purpose.
I just need that the sort order of the item (in the front end) in a way that they could be managed differently on different period. For example, in March to April 2007 I want the items shown in the following order: A B C D ... While in May to August 2007 I want the items shown as B D A C ....
I tried to create an order table just like this:
TableGoodsOrder:
*IDCatalog
*IDItem
*ValidStart
ValidEnd
OrderItem
It is linked with the TableGoods on IDCatalog and IDItem.
The first order list (March - April 2007) will have the ValidStart of 703 and ValidEnd of 704. While the next order list will have the ValidStart of 705 and 708. The last 2 digits stand for the month, while the first digit is to indicate year.
The SQL query for the record source works but I can not enter any value. So, the idea of having a special table for sort order is not OK.
Can anybody give me a clue for the solution?
View 2 Replies
View Related
Dec 6, 2005
I have a table in MS Access with records including dates. The dates are date/time data type and formatted as short dates. They display properly in the table.
However, when I run a query (SQL shown below), it sorts the dates strangely.
Any ideas??
SELECT DISTINCTROW Format$(tblChat.dtDate,'Short Date') AS ChatDate, Sum(tblChat.TCT) AS SumOfTCT, Sum(tblChat.NC) AS SumOfNC
FROM tblChat
GROUP BY Format$(tblChat.dtDate,'Short Date')
ORDER BY Format$(tblChat.dtDate,'Short Date');
Here’s an example of the sort order in the query.
10/31/2005
11/1/2005
11/10/2005
11/11/2005
11/12/2005
11/14/2005
11/15/2005
11/16/2005
11/17/2005
11/18/2005
11/2/2005
11/21/2005
11/22/2005
11/23/2005
View 2 Replies
View Related
Nov 3, 2006
Is there a way to sort dates using "Decending" but have blank dates stay on top?
I have a listbox based on a qurery that displays all pending and completed jobs. The query sorts (Ascending) the "Job Complete" date. This conveniently puts all of the pending jobs with null values at the top of the list. The bad part is that this puts recently completed jobs at the very bottom of a (thankfully) long list. Is there a way around this?
Thank you!
View 5 Replies
View Related
Mar 2, 2005
Okay, here's my new dilema. I'm in the military and rank is one of the fields in my DB. The only issue I'm having is that I would like to sort by seniority, not alphabetically. For Example, I've listed a few ranks below in the correct order from greatest to least. Is there some way that doesn't involve a page of code to achieve this? Thanks.
Colonel
Lt. Colonel
Major
Captain
1st Lt.
2nd Lt.
View 8 Replies
View Related
Mar 14, 2005
I have a query that fills a report that I have in an Access 2000 database. This report needs to be sorted by the following:
Code:ORDER BY tblPrimaryDept.PDName, tblSubDept.SDName, tblKeyStrategy.KSID, tblKeyInitiative.KIID, tblKeyDeliverable.KDID, tblSubDeliverable.TargetDate, tblQuarters.QID;
It's working fine, but .... (There's always a but)
tblKeyStrategy.KSID can be null, so therefore, it is sorted by null records, then ascending order tblKeyStrategy.KSID. What they client wants is it to be sorted by tblKeyStrategy.KSID first, then the null value ones.
ie:
So as it stands it currently does this:
Finance
Finance
Finance 1
Finance 2
Now they want it to do this:
Finance 1
Finance 2
Finance
Finance
Is there any way this can be done? I've been looking, but haven't seen anything regarding this.
Thanks for any assistance you can give me on this.
View 13 Replies
View Related
May 22, 2013
I am building a form in access and I am trying to find a way where user input isn't possible in the associated textbox when "No" from on option box is selected.
View 3 Replies
View Related
Mar 7, 2008
Hi all,
I'm quite new to access, and have a pretty straightforward problem (I hope):
I have a table with 300 records in 10 columns. I want to:
1. filter the data based on column A (gives me 150 visible records)
2. Copy from an excel spreadsheet which exactly matches the access table (single column only, 150 rows)
3. Paste into a new column I created in the access table
Unfortunately, when I hit paste in access, it loses the filter and pastes the data into the complete dataset (i.e. into the wrong records).
I've no idea why access won't keep the filter I set. I also tried numbering the records and sorting them based on this new column. Again, Access lost the sort order before pasting the data.
Help!
I really need to be able to paste my excel data into the table in access!
Can anyone shed some light for me?
Thanks in advance,
Lee
View 4 Replies
View Related
Apr 12, 2005
Hello,
This is related to "Old_value, new_value" thread I posted yestarday (Module&VBA).
I have a problem i missed yestarday. The code it's vorking great, but it allways takes the showed new_value and makes it old_value for the new record, and this is a problem, because the showed record is not the last for that customer.
So, I was thinking that if I make a new Autonumber field in my table, I could sort descending the values and this way the input form will allways show me the last entered data for that person.
As I noticed from a long time ago, if I sort a table that allready has a form, the form won't show the records sorted. Why? It's necessary to make the form again? I tried to order the data on the form from Properties window ->Data->Order by, but the ordering is Ascending and I need it Descending!
Can enybody help me?
Thanx,
Attila
View 1 Replies
View Related
Dec 7, 2005
i have a combo box on a payment form which shows existing permit #s. i'd like to make the sort order show the most recently added permit first. i clicked on the build button next to RowSource on the data tab of the properties of the combo box which opens the query my combo box is based on. there are only 3 sort order options...ascending, descending, & not sorted. can this be done?
the permits form has a button to open the payments form (payments can also be opened alone too - ie. if somone applies for a permit today but pays for it tomorrow...). usually this will not be the case but that is why i have to keep it either combo or list.
all help is appreciated.:)
View 3 Replies
View Related
Sep 15, 2006
I need to manage a list of, in this case "medications", with this list the most common "meds" are on the top of the list. there will be at times new "meds" added that should be at the top of the list. I want to create a unbound box that will let me drag the "meds" up or down in the list. The best emample i know of is the way you can set the "Tab" fields on a form to move the tabs stops.
View 4 Replies
View Related
Nov 29, 2004
How do I change the sort order to display on a form using an option button?
Thanks!
View 1 Replies
View Related
Apr 29, 2008
I am working with Access 2003 and want to save the sort order in a subform. The new sort order would be different from that of the underlying table. The Order By property has been set but isn't working the way I expected. I have tried replacing the underlying table with a query but that hasn't worked out either. I don't want to change the order of the table because other programs that access it would be affected.
I've been reading about an Order By On switch that might do the trick but apparently it's not contained in Access 2003. There must be some other way to skin this cat!
Thanks in advance.
View 4 Replies
View Related