Solved

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

Posted on 2012-03-14
6
337 Views
Last Modified: 2012-03-16
What value does SourceTable property hold for a regular (not linked) Table's Field object? What does "initial" word mean in here please?
0
Comment
Question by:midfde
  • 2
  • 2
6 Comments
 
LVL 45

Assisted Solution

by:aikimark
aikimark earned 334 total points
ID: 37725217
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
 
LVL 1

Author Comment

by:midfde
ID: 37725355
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
 
LVL 12

Assisted Solution

by:danishani
danishani earned 166 total points
ID: 37725771
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
 
LVL 45

Accepted Solution

by:
aikimark earned 334 total points
ID: 37726531
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
 
LVL 1

Author Comment

by:midfde
ID: 37730152
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

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
The canonical version of this article is on my web site here: http://iconoun.com/articles/collisions/ A companion presentation is available here: http://iconoun.com/articles/collisions/Unicode_Presentation.pdf
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now