Douglas J. Steele said:
Try
SELECT [Sales Funnel v1].[Lead Status]
FROM [Sales Funnel v1s] INNER JOIN [Lead Status Sort Orders]
ON [Sales Funnel v1].[Lead Status] = [Lead Status Sort Order].[Lead
Status]
ORDER BY [Lead Status Sort Order].[Sort Order]
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
I am getting a syntax error with the following sql statement:
SELECT [Sales Funnel v1.Lead Status], [Lead Status Sort Order.Lead
Status]
FROM [Sales Funnel v1s] INNER JOIN [Lead Status Sort Orders]
ORDER BY [Lead Status Sort Order.Sort Order]
Any suggestion?
:
That's the SQL for the query you'd need to use.
To build that same query using the graphical query builder, you'd
create
a
new query and add the MyTable and ColourSort tables to the query.
If it doesn't already exist, you'd create a relationship between
MyTable
and
ColourSort by dragging the Colour field from the MyTable table onto
the
Colour field in the ColourSort table.
You'd then drag the fields from the MyTable table into the grid, as
well
as
dragging the SortOrder table from the ColourSort table.
Select Ascending from the Sort row under the SortOrder field.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
I understand creating the sort table, but am unsure where the
following
action is taken:
SELECT MyTable.Field1, MyTable.Field2, MyTable.Colour
FROM MyTable INNER JOIN ColourSort
ON MyTable.Colour = ColourSort.Colour
ORDER BY ColourSort.SortOrder
Where is this done?
Thanks again for your help.
:
Yes, ascending and descending are the only options.
What you can do is create another table that indicates the sort
order
you
want, join the two tables, and sort on the indicator from the 2nd
table.
For example, if you wanted Red to be sorted before Yellow to be
sorted
before Green, you'd create a table ColourSort:
Colour SortOrder
Red 1
Yellow 2
Green 3
You'd then join that table to your existing table:
SELECT MyTable.Field1, MyTable.Field2, MyTable.Colour
FROM MyTable INNER JOIN ColourSort
ON MyTable.Colour = ColourSort.Colour
ORDER BY ColourSort.SortOrder
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Are ascending and descending the only sort options? I have a
specific
sort
order that I would like to assign and it's not necessarily in
alphabetical
order.
:
I have created a report using an Excel linked table. The
Excel
file
and
concurrent report contains a "lead status" column and there
are
about
5
different status. When entering the data on the excel file,
it
will
be
in a
scattered order in terms of the status. However, I would like
to
set
a
specific order for the lead status to display on the report.
Is
this
possible? I should mention that I am a beginner Access user
and
created
the
report through Report Wizard.