Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Argument not optional 1

Status
Not open for further replies.

samotek

Technical User
May 9, 2005
197
BG
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
 
Is the error in the function itself, or in the Click event?Use an On Error structure in both to confine the error. That error could mean Gpath is not initialized--and that could affect the OpenCurrentDatabase command or the killobject function itself.
--Jim
 
alevchurch,
Good catch, I didn't even see that, I was just looking for the gpath assignment.
--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top