如何在Access 2010中获取上传数据库的表名? [英] How to get the table name of the uploaded database in access 2010?

查看:112
本文介绍了如何在Access 2010中获取上传数据库的表名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个访问工具,我可以上传Access数据库。



我使用以下方法导入文件。



DoCmd.TransferDatabase acImport,Microsoft Access,strFilePath,acTable,strFileName,Table。 />


这里strFileName是上传文件的文件名。

但是我没有文件名,我需要文件名中的TableName。



所以请有人告诉我如何获取上传文件的表名吗?

解决方案





解决方案是



  Dim  db 作为 DAO.Database 
Dim tdf As DAO.TableDef
设置 db = OpenDatabase(strDBPath)
strTableName = db.TableDefs( 0 )。名称
DoCmd.TransferDatabase acImport, Microsoft Access,strDBPath,acTable ,strTableName, TempTable

db.Close


Hi,

I have a access tool in which i can upload a Access database.

I use the below method to import the file.

DoCmd.TransferDatabase acImport, "Microsoft Access", strFilePath, acTable, strFileName, "Table" ".

Here strFileName is the filename of the uploaded file.
But instedd of filename i need the TableName inside that filename.

So please can anyone tell me how to get the table name of an uploaded file?

解决方案

Hi ,

The solution is

Dim db      As DAO.Database
Dim tdf     As DAO.TableDef
Set db = OpenDatabase(strDBPath)
strTableName=db.TableDefs(0).Name
DoCmd.TransferDatabase acImport, "Microsoft Access", strDBPath, acTable,strTableName, "TempTable"  

db.Close


这篇关于如何在Access 2010中获取上传数据库的表名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆