PRA: SourceTable Property Returns Zero-Length String

    Article ID: Q122157
    Creation Date: 27-OCT-1994
    Revision Date: 01-DEC-1996

    The information in this article applies to:

    • Microsoft Access versions 2.0, 7.0, 97

    SYMPTOMS

    Moderate: Requires basic macro, coding, and interoperability skills.

    The SourceTable property indicates the name of the table that is the original source of data for a Field object. When you use data access objects (DAO) to return the SourceTable property of a field in a union query, however, you receive a zero-length string instead of the table's name.

    STATUS

    Microsoft has confirmed this to be a problem in Microsoft Access 2.0, 7.0, and 97. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

    MORE INFORMATION

    Steps to Reproduce Problem

    1. Open the sample database Northwind.mdb (or NWIND.MDB in version 2.0).
    2. Create a new module and enter the following sample function:

            '***************************************************************
            ' This function returns the field name and source table for each
            ' field in the Union Query query.
            '***************************************************************
            Function FindSourceTable ()
               Dim db As Database, q As QueryDef, f as Field
               Dim i As Integer
               Set db = CurrentDB()
               Set q = db.QueryDefs("Customers and Suppliers by City")
               For i = 0 To q.Fields.Count - 1
                  Set f = q.Fields(i)
                  Debug.Print f.Name & " ==> " & f.SourceTable
               Next i
            End Function
      
    3. On the View menu, click Debug Window (or Immediate Window in version 2.0).
    4. In the Debug window, type the following line, and then press ENTER:

            ?FindSourceTable()
      

      Note that although the function should return the name of the source table for each field in the Union Query query, you receive zero-length strings instead.

    REFERENCES

    For more information about the SourceTable property, search the Help Index for "SourceTable property," or ask the Microsoft Access 97 Office Assistant.


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.
©1997 Microsoft Corporation. All rights reserved. Legal Notices.

KBCategory: kbprg
KBSubcategory: MdlDao
Additional reference words: 2.00 7.00 97 8.00