Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 360
  • Last Modified:

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?
0
midfde
Asked:
midfde
  • 2
  • 2
3 Solutions
 
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
 
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
 
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.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now