How can I, using VB, to open a database file in Microsoft Access? I just want a command button that opens up Access and the database file. Can someone please help? Thanks in advance!!!
Printable View
How can I, using VB, to open a database file in Microsoft Access? I just want a command button that opens up Access and the database file. Can someone please help? Thanks in advance!!!
Code:Private Sub Command1_Click()
Dim oAccess As Object
Const DBName = "C:\My Documents\db.mdb"
Set oAccess = CreateObject("Access.Application")
oAccess.OpenCurrentDatabase (DBName)
Set oAccess = Nothing