What is the value of "SourceTable" property of Field object in MS Access?

What value does SourceTable property hold for a regular (not linked) Table's Field object? What does "initial" word mean in here please?
LVL 1
midfdeAsked:
Who is Participating?
 
aikimarkCommented:
Since a query has the ability to rename columns, you might need to determine the source (table name and column name).  You can use this (sourcetable) property to provide your code part of the data.  As shown in the danishani comment, you would use the sourcefield property for the other half of data source identification.

If these properties weren't available, you would have to write code to parse the SQL to get this data.
0
 
aikimarkCommented:
It is possible for you to construct a query that pulls data from multiple tables.  This field property might help you analyze the data programmatically.

The word "initial" does not appear in the linked page
0
 
midfdeAuthor Commented:
Sorry, please replace "initial" with "original" in my initial, no, original question.

Also I risk to look obtrusive but could you please explain:
What value does SourceTable property hold for a regular (not linked) Table's Field object?
0
 
danishaniCommented:
Well you can use it in a QueryDef, TableDef and Recordset to return the Table Name where the field resides. That is basicly the function of this property.

Below a small example how you can apply it in a DAO.Recordset:

Dim rst As DAO.Recordset

Set rst = CurrentDb.OpenRecordset("Select [ID] From tblTest")


Do Until rst.EOF

  If rst(0).Value = 2 Then
 
     Debug.Print rst(0).SourceTable
 
     Debug.Print rst(0).SourceField
 End If
 
     rst.MoveNext
     
Loop

Set rst = Nothing

Open in new window


No surprise it wil return the below values in immediate window:
ID
tblTest
0
 
midfdeAuthor Commented:
Although my question was about regular (not linked) Table, and answer were about other types of objects (query recordset), I got the point and I thank participated experts.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.