Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 12th, 2008, 04:00 AM
Authorized User
 
Join Date: Feb 2008
Location: , , .
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to hewstone999
Default SORTING an table

I currently have this data in the "tbl_Infor" Tbale

Tlb_name RowNo Comments
----------------------------------------
MPI 1 Username
MPI 2 Forename
MPI 5 Date
MPI 3 ****
MPI 4 Address
LRD 1 Car
LRD 4 Year
LRD 2 Make
LRD 3 Colour
LRD 5 MODS
LRD 6 TAX DATE


I need a sort function in vba or an SQL statement that will sort the table in order of row number (See below)

Tlb_name RowNo Comments
----------------------------------------
MPI 1 Username
MPI 2 Forename
MPI 3 ****
MPI 4 Address
MPI 5 Date
LRD 1 Car
LRD 2 Make
LRD 3 Colour
LRD 4 Year
LRD 5 MODS
LRD 6 TAX DATE


Any ideas on how this can be done thanks.


  #2 (permalink)  
Old June 12th, 2008, 09:35 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

In general the SQL statement would be something like

SELECT * FROM TableName ORDER BY RowNo

Caution: Don't use reserved words and functions as field names. Currently you have DATE and YEAR as fields. Change those. They will cause problems later if you leave them as is.

Also, you have a field called ****. Is that for real or are you hiding something from us for security reasons? If that's the real name, change that, too!

Avoid spaces in field names. Change TAX DATE to TAX_DATE or dtmTaxDate, etc.



Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division


Similar Threads
Thread Thread Starter Forum Replies Last Post
Collapsible table sorting problem sendkamal Javascript 0 February 27th, 2007 12:33 PM
FSO dynamic table sorting nancy Classic ASP Components 0 August 24th, 2005 12:46 PM
Datagrid sorting by non alphabetical sorting? LLAndy VS.NET 2002/2003 1 July 15th, 2004 01:20 AM
XML to HTML Table with Sorting and Distinct VictorMk XSLT 4 April 23rd, 2004 06:29 PM
size of table (type table is table of number) MikoMax Oracle 1 November 19th, 2003 03:11 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.