Results 1 to 2 of 2
  1. #1
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    365

    Order of fields in Recordset


    Code:
    sql = "SELECT *, cdate([LastBatch]) as pDate FROM tblMain Where LastBatch > " & CLng(GetStoredDate) & " And Source = " & Chr$(34) & s & Chr$(34) & " Order by cdate(LastBatch);"
    Set r = db.OpenRecordset(sql)
    Debug.print r(0).name = pDate.
    Debug.print r(1).Name = id

    But the first field in the table is id. Why is pDate before id ?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Try prefixing wildcard with table name: tblMain.*
    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.

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

Similar Threads

  1. How to determine order of two fields?
    By MsAxes in forum Queries
    Replies: 4
    Last Post: 02-13-2022, 05:52 PM
  2. Replies: 7
    Last Post: 07-01-2021, 05:30 PM
  3. Recordset Order By
    By DMT Dave in forum Access
    Replies: 2
    Last Post: 02-07-2019, 12:42 PM
  4. Add fields to a DAO recordset with VBA
    By smbrush in forum Programming
    Replies: 9
    Last Post: 08-17-2018, 02:43 PM
  5. Replies: 2
    Last Post: 03-07-2016, 05:02 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