Wrong number of arguments

  • Thread starter samotek via AccessMonster.com
  • Start date


samotek via AccessMonster.com

i get the error "wrong number of arguments or invalid proprty assignment"
Can you help me with this problem ?
Private Function KillObject(strDbName As String, acObjectType As Long,
strObjectName As String, 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

Private Sub Command2_Click()
Call KillObject(GPath, 0, "products", "secret")



Douglas J. Steele

According to the Help file, the OpenCurrentDatabase method only takes 2
arguments: the full path to the database, and (optionally) a boolean value
which specifies whether the database should be opened in exclusive mode.

To see how to open a password-protected database, see

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

Similar Threads