Results 1 to 5 of 5
  1. #1
    Kiteknight is offline Novice
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    7

    Only retruning one recordset when using a strSQL based on a select query.

    Public Sub loadArray()
    Dim rs As DAO.Recordset
    Dim db As DAO.Database
    Dim strSQL As String

    strSQL = "SELECT tblList.ID, " & "tblList.DateAdd, " & "tblList.CPT, " & "tblList.Description, " & "tblList.RVU " & "FROM tblList; "

    Debug.Print strSQL
    Set db = CurrentDb
    Set rs = db.OpenRecordset(strSQL)
    Debug.Print rs.RecordCount


    Set db = Nothing
    Set rs = Nothing




    'all works without error although the recordcount is only 1 where there should be many more. Any suggestions would be appreciated.

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Set rs = db.OpenRecordset(strSQL)
    rs.movelast 'populate recordset
    Debug.Print rs.RecordCount

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    Also, all that concatenation is not needed:

    strSQL = "SELECT ID, DateAdd, CPT, Description, RVU FROM tblList;"
    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.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I didn't even notice the aperasands

  5. #5
    Kiteknight is offline Novice
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    7
    Excellent!! Very much appreciated.

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

Similar Threads

  1. Replies: 2
    Last Post: 05-05-2013, 12:41 PM
  2. Replies: 5
    Last Post: 05-01-2013, 11:39 AM
  3. How to Select second Recordset from first recordset
    By FrustratedAlso in forum Programming
    Replies: 28
    Last Post: 05-10-2012, 05:45 PM
  4. creating recordset based on query
    By akrylik in forum Access
    Replies: 8
    Last Post: 05-10-2012, 02:57 PM
  5. Select based on Max Query
    By eww in forum Queries
    Replies: 2
    Last Post: 05-13-2011, 01:11 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