Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Apr 2002
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to Include Variable in Statement (97)

    Bad case of fried brain syndrome here and would appreciate what I'm hoping is a simple answer.

    I'm writing a procedure to cycle through the linked tables in a database and ensure they are linked from the correct source. Hopefully - I'm nearing completion but am having trouble structuring the command to reset the ".Connect" for a table if it is showing the wrong source.

    I have a variable of strTblName which is assigned the table's definition's name:

    strTblName = tdf.Name

    Then I want to use strTblName in the following statement to set the connection to the appropriate source:

    db.TableDefs!strTblName.Connect = ";DATABASE=" & strNewLocation

    But I can't remember the correct syntax to use to get the statement to accept the strTblName instead of hard coding in the actual table names.

    TIA

    Texas TJ

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: How to Include Variable in Statement (97)

    Use

    db.TableDefs(strTblName).Connect = ";DATABASE=" & strNewLocation

  3. #3
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to Include Variable in Statement (97)

    You can use :
    db.TableDefs(strTblName).Connect = ";DATABASE=" & strNewLocation
    Francois

  4. #4
    Star Lounger
    Join Date
    Apr 2002
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to Include Variable in Statement (97)

    Thanks ever so much for the prompt (and accurate) replies!! The procedure to ensure the tables being accessed are from the correct location is now working.

    My tired brain thanks you too.

    Texas TJ

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •