如何在MS Access中连接到.mdb数据库

问题描述:


我想知道如何连接到数据库以获取我在Access女士中创建的登录表单.这是我一直在尝试的代码,因为您可以通过Access Forms在VB中进行编码.

Hi,
I was wondering how to connect to the database for a login form i am making in Ms Access. This is the code what i have been trying as you can code in VB from Access Forms.

Set driver = "Microsoft Access Driver (*.mdb)"
    Set dbfile = "G:\Databases\Game\Games.mdb"
    
    If (![file exists $dbfile]) Then
        MsgBox ("Cannot Connect To the Database!");
    End If
    
    database connect db "DRIVER=$driver;DBQ=$dbfile"



关于如何解决它的任何建议 ?



Any suggestions on how to fix it?

dbfile])然后 MsgBox(无法连接到数据库!"); 万一 数据库连接数据库"DRIVER =
dbfile]) Then MsgBox ("Cannot Connect To the Database!"); End If database connect db "DRIVER=


驱动程序; DBQ =
driver;DBQ=


dbfile"



关于如何解决它的任何建议 ?



Any suggestions on how to fix it?