Compile error

  • Thread starter samotek via
  • Start date


samotek via

n my function listed below i get compile error in the following line :
adb.OpenCurrentDatabase (strDbName,,strPassword)
can you help ?

Private Function KillObject(strDbName As String, acObjectType As Long,
strObjectName As String, StrPassword As String)
'Call KillObject(GPath, 0, "products")
Dim StrPassword As String
StrPassword = "secret"
Dim db As DAO.Database
Dim adb As Object
Set adb = CreateObject("Access.Application")
adb.OpenCurrentDatabase (strDbName,,strPassword)
adb.DoCmd.DeleteObject acObjectType, strObjectName
Set adb = Nothing
End Function



alecwood via

If you take the brackets off on that line thus

adb.OpenCurrentDatabase strDbName, , StrPassword

this should work. Dunno why though since the VBA help on OpenCurrentDatabase
shows the brackets being used, but anyway, it worked for me without them,
though I did define the Exclusive parameter as False, thus

adb.OpenCurrentDatabase strDbName, False, StrPassword


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question