When clicking on the event Call KillObject(GPath, 0, "products"), i get the message argument not optional
Can you tell me why ?
Private Function KillObject(strDbName As String, acObjectType As Long, strObjectName As String, StrPassword As String)
'Call KillObject(GPath, 0, "products")
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
Private Sub Command2_Click()
Call KillObject(GPath, 0, "products")
End Sub
Can you tell me why ?
Private Function KillObject(strDbName As String, acObjectType As Long, strObjectName As String, StrPassword As String)
'Call KillObject(GPath, 0, "products")
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
Private Sub Command2_Click()
Call KillObject(GPath, 0, "products")
End Sub