Results 1 to 4 of 4
  1. #1
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862

    SQL Order By Date Field

    I need to import some records into a table via SQL. I need to make sure the records are created in order by date. The reasons or crazy, but it has to do with data varification in a later process. I want the PK order to mirror the date field order.

    The question is, "Will SQL sort my dates in sequence?" Here is the code I am using.

    Code:
    db.OpenRecordset("SELECT UpdateNew, UserID, TransactionDate " _
                           & "FROM tblFasTrakHistory " _
                           & "WHERE UpdateNew = 0 AND UserID = 0 " _
                           & "ORDER BY TransactionDate;", dbOpenDynaset)


  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    Could test by import to a new temporary table.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    I am lazy.....

    Actualy, I shelved this and now I am coming back to it. Don't remeber what I did last and I looked at the table and it has a sort order to it. Can't remove the table sort order.

    So I guess I will have to motivate myself and build something out...

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    It seems to be doing fine, grabbing the dates in the order I need. My notes said to revisit the Order By in the SQL. After combing through it, it seems the test data I was importing was imported in small amounts of records. This was causing me to question the order the records were being imported. Looking at the table, it looked like it was not in order.

    I'm thinking wine bar and tapas are in order now. This module will go live tomorrow morning.....

Please reply to this thread with any new information or opinions.

Similar Threads

  1. how to display the last order date
    By JRCharlie in forum Access
    Replies: 5
    Last Post: 05-25-2013, 06:00 PM
  2. Replies: 6
    Last Post: 12-07-2012, 07:57 AM
  3. Replies: 5
    Last Post: 07-03-2012, 12:15 PM
  4. Sorting a form's records in order by date.
    By slikbaz in forum Access
    Replies: 3
    Last Post: 11-20-2010, 01:11 AM
  5. Setting a field in order for Report
    By cotri in forum Reports
    Replies: 2
    Last Post: 01-28-2010, 02:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums