D
dbguru316
I have read many responses for the error code 3061 but to no avail. Below is
the code, and when run get the error message 3061 - too few paramters,
expected 6.
The error is driven by the strSaveFileName parameter in the strSQL variable.
I have added an quote on both sides, still not resolved.
Function AddDocumentFile()
Dim strFilter As String
Dim lngFlags As Long
Dim strSaveFilePath, strSaveFileName, strSQL As String
Dim db As DAO.Database
Set db = CurrentDb
DoCmd.RunCommand (acCmdSaveRecord)
strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
strSaveFilePath = ahtCommonFileOpenSave(InitialDir:="C:\", _
Filter:=strFilter, FilterIndex:=3, flags:=lngFlags, _
DialogTitle:="Choose the file to add into Document Control")
strSaveFileName = Right(strSaveFilePath, Len(strSaveFilePath) -
InStrRev(strSaveFilePath, "\"))
strSQL = "INSERT INTO tmpDocListing ( DocNumber, DocRev, DocType,
Customer, DocDescription, AddedBy, DocFileName ) " & _
"SELECT [Forms]![frmDocumentAdd]![DocNumber] AS Expr1,
[Forms]![frmDocumentAdd]![DocRev] AS Expr2,
[Forms]![frmDocumentAdd]![DocType] AS Expr3, " & _
"[Forms]![frmDocumentAdd]![Customer] AS Expr4,
[Forms]![frmDocumentAdd]![DocDescription] AS Expr5,
[Forms]![frmDocumentAdd]![AddedBy] AS Expr6, '" & strSaveFileName & "' AS
Expr7;"
db.Execute strSQL, dbFailOnError
Set db = Nothing
End Function
the code, and when run get the error message 3061 - too few paramters,
expected 6.
The error is driven by the strSaveFileName parameter in the strSQL variable.
I have added an quote on both sides, still not resolved.
Function AddDocumentFile()
Dim strFilter As String
Dim lngFlags As Long
Dim strSaveFilePath, strSaveFileName, strSQL As String
Dim db As DAO.Database
Set db = CurrentDb
DoCmd.RunCommand (acCmdSaveRecord)
strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
strSaveFilePath = ahtCommonFileOpenSave(InitialDir:="C:\", _
Filter:=strFilter, FilterIndex:=3, flags:=lngFlags, _
DialogTitle:="Choose the file to add into Document Control")
strSaveFileName = Right(strSaveFilePath, Len(strSaveFilePath) -
InStrRev(strSaveFilePath, "\"))
strSQL = "INSERT INTO tmpDocListing ( DocNumber, DocRev, DocType,
Customer, DocDescription, AddedBy, DocFileName ) " & _
"SELECT [Forms]![frmDocumentAdd]![DocNumber] AS Expr1,
[Forms]![frmDocumentAdd]![DocRev] AS Expr2,
[Forms]![frmDocumentAdd]![DocType] AS Expr3, " & _
"[Forms]![frmDocumentAdd]![Customer] AS Expr4,
[Forms]![frmDocumentAdd]![DocDescription] AS Expr5,
[Forms]![frmDocumentAdd]![AddedBy] AS Expr6, '" & strSaveFileName & "' AS
Expr7;"
db.Execute strSQL, dbFailOnError
Set db = Nothing
End Function