?
Solved

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

Posted on 2012-03-14
6
Medium Priority
?
348 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
6 Comments
 
LVL 46

Assisted Solution

by:aikimark
aikimark earned 1336 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 664 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 46

Accepted Solution

by:
aikimark earned 1336 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

649 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