Results 1 to 3 of 3
  1. #1
    Praveenevg is offline Novice
    Windows 8 Access 2007
    Join Date
    Aug 2014
    Posts
    18

    Open recordset

    Hello ,

    I am currently using this statement to get access to records in my MS-Access table:
    Set rs = CurrentDb.OpenRecordset("SELECT * FROM MASTER_JOB_LIST")

    Is there anyway to pass name of the "Table" to be opened in a dynamic manner? In this case, I hard coded the table name as MASTER_JOB_LIST; Is there anyway to pass name of this table through a variable?

  2. #2
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614
    Yes,
    Code:
    Dim strSQL as String
    strSQL="SELECT * FROM " & [YourVariableForTableName]
    Set rs = CurrentDb.OpenRecordset(strSQL)

  3. #3
    Praveenevg is offline Novice
    Windows 8 Access 2007
    Join Date
    Aug 2014
    Posts
    18
    Thanks. It worked.

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

Similar Threads

  1. Recordset Open Error
    By RayMilhon in forum Programming
    Replies: 4
    Last Post: 08-27-2013, 05:54 PM
  2. recordset open error on SQL query
    By Siuxia in forum Programming
    Replies: 5
    Last Post: 05-30-2012, 08:02 AM
  3. Excel sheet open in recordset
    By waqas in forum Programming
    Replies: 3
    Last Post: 09-22-2011, 11:47 AM
  4. open recordset with variable SQL
    By rivereridanus in forum Queries
    Replies: 4
    Last Post: 07-27-2011, 12:58 PM
  5. ADO Recordset.Open (SQL) does nothing
    By workindan in forum Programming
    Replies: 3
    Last Post: 06-23-2010, 02:07 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