is it possible to use variable for sorting?
declare @sort varchar(10)
SET @sort='column1 DESC'
SELECT ROW_NUMBER() OVER (ORDER BY @sort)AS rowId, * FROM table
Is dynamic SQL only option?
On 15/04/2010 11:28, simon wrote:
> is it possible to use variable for sorting?
> Something like:
> declare @sort varchar(10)
> SET @sort='column1 DESC'
> SELECT ROW_NUMBER() OVER (ORDER BY @sort)AS rowId, * FROM table
> Is dynamic SQL only option?
You can use CASE to he...How to sort account list?
I'm using MS Money 2004 Small Business. In the account list, my accounts
are catagorized by and in this order:
- bank accounts
- credit accounts
- investment accounts
- loans and liabilities
- asset accounts
In the above view, I cannot easily determine totals for assets and
liabilities. The following view does this.
- bank accounts
- investment accounts
- asset accounts
-loans and liabilities
How do I get the above view?
I don't use Small Business. But you can run a Net Worth report to get total
assets and ...protected worksheet won't unprotect
I have an Excel spreadsheet out on our network which is
protected; I need to make changes to it. When I go to
make a change it brings up the message "The cell or chart
you are trying to change is protected and therefore read-
only." It says to remove protection via Tools->Protection-
>Unprotect Sheet command. I go to that menu, but the
Unprotect option is grayed out. Can anyone please tell me
what I'm missing or doing wrong?
is this workbook shared?. If yes then this procedure is not possible
...Where's the Sort by New Message option?
Not sure when the layout of the newsgroups changed but I can't seem to find the ability to sort by new message in a thread instead of sorting by just the original thread date.
That was hugely helpful as I could follow along and see what threads were still active.
If you're gonna hang around in the newsgroups (any newsgroups), you may want to
start using a newsreader.
Microsoft Outlook Express can do it for you.
Saved from a previous post:
You may want to connect to the ms newsserver directly:
If you have Outlook Express installed, try clicking on these links (or copy and
paste i...Row names will not move with sort
Each row in my summary table in Sheet1 is hyperlinked to a corresponding table in Sheet2 with additional details.
I need to move the rows in my summary table (Sheet1) and preserve the links to and from the details tables (Sheet2).
I found that I can move rows in Sheet1 with cut & insert and the hyperlinks are maintained. I can travel from a row in summary table (Sheet1) to details table (Sheet2) and back, even after the corresponding row (Sheet1) was moved.
But if I sort the rows in Sheet1 the links from Sheet2 back to corresponding rows in Sheet1 lead to presorted locations. Apparen...set default record to a table
I have a shared db with various front ends (mde). I would like to set a
paricular record as my default record, so whenever someone opens up the
various db forms it opens up to the same default record. Is this possible?
Maybe this is a matter of terminology...
In Access, data is stored in tables. Each table has it's own records
(collections of related data).
When you say you want a "record" to be the default one pulled up by
everyone, how do you know they are all using their different forms to look
at the same data (i.e., table)?
Next, why? What is it about ...Call value from table not form
I am probably overlooking something stupid here but, I need to pull a value
from a table when a form is not open?
Dim InternalEmail As String
InternalEmail = Forms!frmCommitteeEmail!DMEmail
this gives an error if the form frmCommitteeEmail is not already open. I am
pretty sure that is the problem because if I add code to first open the form
it works fine.
Any help here will be appreciated.
Thanks in advance
> I am probably overlooking something stupid here but, I need to pull a
> value from a table when a form is not open?
> Dim InternalEmail As String
> I...sorts not sorting
OK- Thanks to everyones help I now i have a list i can work with... but
there are a few problems.... the zips are all 5 digit and now i have to
sort them... the problem is, THEY WONT SORT CORRECTLY!!!!!!! The
numbers are not in order... some are but a lot are not... is there
anyway to fix this???? i need to sort them by zip code but cant seem to
get them to do it correctly.. any ideas???
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/
You are going to be far better of...How do I format the tabs of a worksheet in Excel?
I am wondering if there is way to change the font size, font color, or tab
color so it is easier to keep my sheets straight. I dont really want to make
a table of contents or anything like that, I just need certain sheets to
stand out more than others.
If you have Excel 02, you can change the colors by right clicking on the
tabs, If your version is earlier, you are out of luck
> I am wondering if there is way to change the font size, font color, or tab
> color so it is easier to keep my sheets straight. I dont really want to make
> a table of...How do I return the table structure using an SQL command in a quer
In a VBA function, I need to fill a combo box with the table fields name.
Could you please help me on this?
You've described "how" you are trying to do something.
If you'll describe "why" you want to do this, the newsgroup readers may be
able to offer more specific suggestions.
Microsoft Office/Access MVP
"Wagner Mokva" <WagnerMokva@discussions.microsoft.com> wrote in message
> In a VBA function, I need to fill a combo box with the table fields...Budget vs. Spending table
I'm switching from Money 2005 to 2007. In the 2005 version, under "Budget
Summary" on the left sidebar from the Home page was a link to a report/table
called "Budget vs. Spending. The table eas titled "Compare Actual Spending
to Your Budget" and near the top had a drop down box to select the time
period for the table. Below the table had the actual categories, spending,
budget and difference in columns. Order was by category.
I can't find this same table/report in 2007. Closest is viewing "Monthly
Budget report - similar layout but no time choi...import- number- sort?
I imported this data into a spread sheet- I tried to format it to number,
but when I sort it- I get :
Whats up with this?
Install the TrimAll macro, select the column and invoke
the macro from Alt+F8
Directions to install and use a macro at
I expect that you have spaces or CHAR(128) "Required Blank"
characters in you data you can check is =LEN(A1)
David...Underlining figures in tables
In the past, whenever a document has had columns of dollar amounts and
totals, I've always placed a narrow-width column between each regular column
so that when underlining the cells above the "Total," in each column, it
would not appear as one straight line spanning several columns.
However, I've just taken over a long document from someone else who has
underlined the last items in the columns before the totals--and the lines do
not extend all across the column; in other words, they look like mine, but
without all the trouble I've gone through!
Please...Protecting range limits
I need help writing code to protect part of a range given a set of limits.
Example: on a 5 x 5 matrix, given n=3, I need to protect rows 4,5 and columns
4,5. Given n=2, I need to protect rows and columns 3,4,5.
Help is very much appreciated.
Hi! What is the maximum rows allowed in a data range when using a pivot table?
I have a pivot table that uses a data range. When I have only 4581 records
in the data range, the pivot table updates with no problems. But, when
entering more than 4581, the pivot table won't update and gives me an error.
Am I hitting the max on data rows within my data range or is there a
The following MSKB articles outline PivotTable limitations for different
versions of Excel:
XL2000: Limits of PivotTables in Microsoft Excel 2000
http://support.microsoft.com/de...sorting macro #3
I need to sort on 8 cells in a row and on 1500+rows. I can do it one at a
time but I know there must be an easier way. Can ANYONE HELP?
C3:J3 I need these cells sorted and then down to C1532:J1532
I did create a macro to sort after I selected them but still one at a time.
Does it have to be a macro? I can edit a macro but don't really know how to
Yes, it has to be a macro. The following should do it. This macro loops
through all the entries in Column C, and in each row it sorts the values in
Columns C:J. HTH Otto
Dim rColC As Range
Dim i As...Can we sort a form and also be able to enter new records.
It is possible to sort the data on a form and also be able to enter
new and edit the existing records in it.
On Tue, 15 Jan 2008 15:41:16 -0800 (PST), Rex wrote:
> It is possible to sort the data on a form and also be able to enter
> new and edit the existing records in it.
I assume you mean "Is it".
The form sort order has nothing to do with editing or adding new
records, so the answer is yes.
If you cannot edit or add new records, make sure the form's record
source, if it is a query, is updateable. Some queries are not.
O...Sorting checking register
How do i sort my check register in Money 2004 Deluxe so
that uncleared transactions appear below cleared
transactions? In Quicken i could click on the column to
provide that sort.
In microsoft.public.money, Dean wrote:
>How do i sort my check register in Money 2004 Deluxe so
>that uncleared transactions appear below cleared
>transactions? In Quicken i could click on the column to
>provide that sort.
You don't. Available choices are chosen by clicking View at the top
of the register.
...using addrress books to sort incoming mail
I use address books to sort incoming mail.
An odd thing: depending on how the sender's name comes across, it doesn't
get caught by the filter (amd moved to the "Family Mail" Folder I have set
up. for example: my mom and dad's email (from firstname.lastname@example.org)
comes as from that address. However, in my contacts, they are listed by
their names: John and Mary Smith, with email@example.com as their
email address and John and Mary Smith as the display name.
What have I done wrong?
1. The big ONE - failed to post your version of Outlook. Rules operate at
...Count records from different table
Not sure if this is even do-able or not.
I have a form (lets call it FORM A) that has details information about each
Case. Each case can have multiple Collection records.
I want text box on FORM A that just tells me the number of Collection
records with the same Case number.
I tried DCount in a new unbound text box, but i just get '#Error'.
You can use an unbound textbox, and in the form's On Current event open a
recordset of the table, then populate the textbox with the recordcount from
For example, if your other table was called TBL an...Disabled "Switch Row/Column" when creating chart from a pivot tabl
I have a pivot table where there are week numbers and three different data
values pr week. This I want to graph so that the weeks are on the X-axis, the
values on the Y-axis and a legend telling which of the three datasets are
When I create a Line graph the weeks are put as a legend and the X-axis have
the three different datasets grouped. This is not what I want. When I go into
"the "Select data..." dialog box all the options are disabled. Why is this
and how can I get the graph to show the way I want?
You will need to pivot your pivot table to move the row fiel...Pivot Table
In a Excel Pivot Table, when we double-click a cell in the Data area,
a new sheet is created with the details.
What I want to do (I already did it in the past), is when I click a
cell in the Row area, several sheets are created (one per value).
I have already had this feature in Excel in the past (I think it was
an add-on), but I don't remember how to do it again.
I think you mean from the Page field, not the Row field.
From the PT Toolbar>dropdown>Show Pages
"Valente" <firstname.lastname@example.org> wrote in messag...What table is the SOPType lookup table?
I'd like to do a sql join from sop tables and rather then hard code
the soptype description such as 2=Order, 3=Invoice, 4=Return, I want
the join to return the description by getting it from the sop type
lookup table. Can't locate the lookup table. Can someone please send
me the lookup table. Thanks.
Unfortunatlety there is no lookup table for this information. In the past, I
have created my own table to serve as a lookup. The table closest to the
information you arer looking for is [SOP40300].
Envisage Software Solutions Pty. Ltd.
I have just figured out how to protect the format of cells so that when a
date is input it always goes to the same format and font etc, and the format
cannot be changed by anyone. However, when a date cell is copied from another
excel file to my protected cell it does not revert to my desired format. How
can I ensure that whenever anything is pasted into the cell that the format
will automatically revert to my desired format? (ie without having to paste
special) - (maybe some VB code will do this???)
One way around this is to just change the number format each time a cell
ch...Unmerge so I can sort
I coy/pasted data into Excell and when I try to sort it I get "This operation
requires merged sells to be identically sized". I understadn the work around
in KB but how do I find which sells are merged?
I wouldn't bother looking.
I'd just remove all the merged cells from the range to sort.
Select that range
uncheck the merge cells box
But if you wanted to search, you can do it via process of elimination. Select a
range, format|cells|alignment tab.
If that merge cells box is checked, then the whole selection is merged. If it's