get table name for field in form based on query

  • Thread starter Thread starter BlueWolverine
  • Start date Start date
B

BlueWolverine

Hello,

MS ACCESS 2003 on XP PRO.

I have a form (MyForm) that uses MyQuery as its data source. The fields are
largely bound to MyQuery. MyQuery pulls together several MyTableX. (dim X
as int and smile :-D


I want to extract in VBA the name of the table a particular field comes from
on the form. So if on the form, I have a field, called MyFormField, I want
to get its Table name.

bob = me.MyFormField.tableName ' bob as string
and then you get bob = MyTableX whichever it may be.


That's the result I'm hoping for, I am guessing said method does not exist
but does anyone have an idea on how to get this result?

thanks a ton.
 
BlueWolverine said:
Hello,

MS ACCESS 2003 on XP PRO.

I have a form (MyForm) that uses MyQuery as its data source. The fields
are
largely bound to MyQuery. MyQuery pulls together several MyTableX. (dim
X
as int and smile :-D


I want to extract in VBA the name of the table a particular field comes
from
on the form. So if on the form, I have a field, called MyFormField, I
want
to get its Table name.

bob = me.MyFormField.tableName ' bob as string
and then you get bob = MyTableX whichever it may be.


That's the result I'm hoping for, I am guessing said method does not exist
but does anyone have an idea on how to get this result?

thanks a ton.

bob = me.MyFormField.SourceTable

ought to do it.
 
Stuart McCall said:
bob = me.MyFormField.SourceTable

ought to do it.

Mistake. It should read:

bob = CurrentDb.QueryDefs!MyQuery!MyFormField.SourceTable

*Warning* this is untested code, but it ought to work. Post back if not.
 
Back
Top