Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634

    Unanswered: Query Properties in VBA

    I have a piece of code that I am using to get some db information to an xls file. One of the things I would like to output is the "Destination Table" property for Append Queries.

    dB.QueryDefs(lQryCnt).Properties("Destination Table") is not working.

    Does anyone know the proper way to refer to the query properties in vba?

    Any thoughts or input would be appreciated.

  2. #2
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    As far as I know, it can't be done directly. However, it is inherent in the query's SQL, of course.
    Code:
    CurrentDb.QueryDefs("Your Query Name").Properties("SQL").Value
    returns the entire SQL, which you can then edit.

    Hope this helps,
    Sam

  3. #3
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    Thanks for your response.

    I'm using dB.QueryDefs(lQryCnt).SQL to fill a different column. I was hoping not to have to go through all of the queries indivually. I've inherited about 30 interlinking databases and zero documentation. I'm trying to get a handle on the data flow/relationships and layout.

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Code:
    MID(MyQueryDef.Sql, 12)
    will ensure the first character is the start of the table name. If it begins with a "[" then the next "]" will mark the end of the table name, otherwise it will be the next space. No probs
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    Thanks. That's exactly what I needed.

Posting Permissions

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