Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tabledefs: How can I set it to current table?

Status
Not open for further replies.

santosh1

Programmer
Apr 26, 2002
201
US
Hello-

I want to set the tabledef to current table. How can I do this? I use the following code, but gives me error. Can you please let me know ?
I appreciate your help very much. Thanks.


Function Test_Attachment(cFileName As String, cElement As String) As String

On Error GoTo Err_Test_Attachment

Dim MyWorkspace As Workspace, MyDataBase As Database
Dim MyTableDef As TableDef, cTableName As Database

Test_Attachment = "0"

Set MyWorkspace = DBEngine.Workspaces(0) ' Get default workspace.
Set MyDataBase = MyWorkspace.Databases(0) ' Get current database.

MyDataBase.TableDefs.Refresh

Set MyTableDef = MyDataBase(cFileName) ' Get current table /I get error here


Santosh
 
Try this route (assuming your table name is table1)

Set MyTableDef = MyDataBase.TableDefs("table1")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top