Compile error

  • Thread starter samotek via AccessMonster.com
  • Start date
S

samotek via AccessMonster.com

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
adb.CloseCurrentDatabase
Set adb = Nothing
End Function
 
A

alecwood via AccessMonster.com

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

Alec
 

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

Top