Error 3061

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Cathy

    Error 3061

    I get this error "Too few parameters. Expected 1" when trying to run
    the following code. Can someone please help me. Thanks in advance

    Dim db As DAO.Database ' Current database
    Dim sSQL As String

    'Remove any cancelled update still in the tmp table.
    Set db = DBEngine(0)(0)
    sSQL = "DELETE FROM " & sAudTmpTable & ";"
    db.Execute sSQL

    ' If this was not a new record, save the old values.

    If Not bWasNewRecord Then
    sSQL = "INSERT INTO " & sAudTmpTable & " ( audType, audDate,
    audUser ) " & _
    "SELECT 'EditFrom' AS Expr1, Now() AS Expr2,
    NetworkUserName () AS Expr3, " & sTable & ".* " & _
    "FROM " & sTable & " WHERE (" & sTable & "." & sKeyField &
    " = '" & lngKeyValue & "');"
    db.Execute sSQL, dbFailOnError
    End If
    AuditEditBegin = True

    Exit_AuditEditB egin:
    Set db = Nothing
    Exit Function

    'Err_AuditEditB egin:
    'Call LogError(Err.Nu mber, Err.Description , conMod &
    ".AuditEditBegi n()", False)
    'Resume Exit_AuditEditB egin
  • Mike Storr

    #2
    Re: Error 3061

    On 19 Feb 2004 13:25:55 -0800, Cathy wrote:
    [color=blue]
    > I get this error "Too few parameters. Expected 1" when trying to run
    > the following code. Can someone please help me. Thanks in advance
    >
    > Dim db As DAO.Database ' Current database
    > Dim sSQL As String
    >
    > 'Remove any cancelled update still in the tmp table.
    > Set db = DBEngine(0)(0)
    > sSQL = "DELETE FROM " & sAudTmpTable & ";"
    > db.Execute sSQL[/color]

    For starters, the DELETE query must contain at least one field name between
    the DELETE and FROM even thought it will delete the entire record. Use
    "DELETE' & sAudTmpTable & ".* FROM " & sAudTmpTable & ";"
    if you just want to get rid of everything.

    Have you stepped through to see where the failure is?
    --
    Mike Storr

    Comment

    Working...