CurrentDB和CurrentProject有什么区别?
Access考试中有这么一道题:
……
Private ADOcn As New ADODB.Connection
Private Sub Form_Load()
'打开窗口时,连接Access本地数据库
Set ADOcn = ______________________
End Sub
……
在横线上应填写的是
A) CurrentDB
B) CurrentDB.Connention
C) CurrentProject
D) CurrentProject.Connection
答案说选最后一项。
那为什么不选CurrentDB.Connection呢?
CurrentDB和CurrentProject有什么区别?
它们各自在什么情况在使用呢?
[解决办法]
CurrentDB是个方法,
CurrentProject是个属性。
CurrentDB.Connection是无效的。
The CurrentDb method returns an object variable of type Database that represents the database currently open in the Microsoft Access window.
The CurrentProject object refers to the project for the current Microsoft Access project (.adp) or Access database (.mdb).