Solved

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

Posted on 2012-03-14
6
340 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

810 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