wrong number of arguments

  • Thread starter peljo via AccessMonster.com
  • Start date
P

peljo via AccessMonster.com

Can you help me? I get the error wrong type of arguments in my function as
follows
Private Sub Command0_Click()
Call ANewDBWithPass("c:\BE\Lest", "secret")
End Sub

Function ANewDBWithPass(ByVal tName As String) '// adds the current date to
the name of the database
Dim wsp As Workspace
Dim db2 As Database
Set wsp = DBEngine.Workspaces(0)
If Right(tName, 4) = ".mdb" Then
' Remove .mdb from the name
tName = Left(tName, Len(tName) - 4)
End If
' Add date and extension
tName = tName & Format(Date, "dd-mm-yyyy") & ".mdb"
' Create database
',Set db2 = wsp.CreateDatabase(tName, dbLangGeneral)
Set db2 = wsp.CreateDatabase(tName, dbLangGeneral & ";pwd=" & strPassword)
db2.Close
End Function
 
M

Marshall Barton

peljo said:
Can you help me? I get the error wrong type of arguments in my function as
follows
Private Sub Command0_Click()
Call ANewDBWithPass("c:\BE\Lest", "secret")
End Sub

Function ANewDBWithPass(ByVal tName As String) '// adds the current date to
the name of the database
[snip body of function]

You declared the Sub with one argument, but you called it
with two strings. What do expect it to do with the second
string?
 

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