Results 1 to 5 of 5
  1. #1
    emanon is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2020
    Posts
    8

    Pull in all rows from a SQL Server Table.


    I need some advice on how I can pull in all rows from SQL Server Table without linked table in MS Access? The reason why we cannot use link table is because the table name will change and creating the linked table on the fly will not work due to DLL problem. I would think we can modify the below code to pull in all results directly from SQL Server. Right now, I have a linked table with my userName. So, it works fine for me, but not for others who will need to use it.


    Code:
        ' Load to query result
        strSQL = "Select * from RPT_MSAccess_APP_" + UserName + "_ComplianceDashBoard "
    
    
        Dim qdf As DAO.QueryDef
        Set qdf = CurrentDb.QueryDefs("qryResult")
        qdf.SQL = strSQL
    
    
        DoCmd.OpenQuery ("qryResult")
        Set qdf = Nothing

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    If qryResult was a pass through query, it would work for any valid table.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    emanon is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2020
    Posts
    8
    Duplicate post.
    Last edited by emanon; 07-06-2020 at 07:04 AM. Reason: Duplicate post

  4. #4
    emanon is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2020
    Posts
    8
    Quote Originally Posted by pbaldy View Post
    If qryResult was a pass through query, it would work for any valid table.
    Is there some example for this. I don't understand how we can do pass type from MS Access to SQL Server. Thanks,

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 1
    Last Post: 09-30-2019, 04:31 AM
  2. Replies: 3
    Last Post: 09-10-2016, 09:08 PM
  3. Replies: 1
    Last Post: 06-12-2015, 02:02 PM
  4. Replies: 2
    Last Post: 09-13-2011, 11:21 AM
  5. Replies: 1
    Last Post: 03-23-2010, 09:18 AM

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