Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2003
    Location
    the Netherlands
    Posts
    15

    Unanswered: Problem with Recordset: Too few parameters

    The Compiler gives Run-time error 3061 : Too few parameters. Expected 1.
    http://support.microsoft.com/default...b;en-us;168194
    As what do I have to declare Data1 ?
    Could someone help me to solve this problem?

    Private Sub btnSaveNewShape_Click()
    On Error GoTo Err_btnSaveNewShape_Click

    Set Db = CurrentDb
    strInsertSQL = "INSERT INTO Shapes VALUES ('" & txtShapeID & "','" & txtShapePNumber _
    & "','" & txtShapeSNumber & "','" & txtShapeName & "')"

    strCheckShapeName = "SELECT * FROM Shapes WHERE ShapeName = " & txtShapeName
    Set checkSNmRS = Db.OpenRecordset(strCheckShapeName, dbOpenDynaset, dbSeeChanges) '<---- This was marked in YELLOW after compiled.
    Data1.RecordSource = checkSNmRS
    Data1.Refresh

    If Not IsNothing(txtShapePNumber) Then
    If Not IsNothing(txtShapeName) Then
    If checkSNmRS.RecordCount = 0 Then
    Db.Execute strInsertSQL
    Else
    MsgBox "Name Already Exist"
    End If
    Else
    MsgBox "ShapeName Required"
    End If
    Else
    MsgBox "Shape Main-Number Required"
    End If


    Exit_btnSaveNewShape_Click:
    Exit Sub

    Err_btnSaveNewShape_Click:
    MsgBox Err.Description
    Resume Exit_btnSaveNewShape_Click

    End Sub
    Last edited by Tjung; 10-27-03 at 11:28.

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Yep, add a space either after the last VALUES paren or before the inline SELECT keyword ...

    strCheckShapeName = " SELECT

  3. #3
    Join Date
    Oct 2003
    Location
    the Netherlands
    Posts
    15
    Thnx, but still doesn't work. Same Error

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Sorry about that ... Solution to the wrong problem ... What is the type of ShapeName? If it's String then you need to surround your literal value with quotes (and in this case single quotes) ...

  5. #5
    Join Date
    Oct 2003
    Location
    the Netherlands
    Posts
    15
    hehe yeah... that was the problem... Database works with single quotes
    solved it before I read this msg
    but anyway THNX a lot!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •