none
Too few Parameters. Expected 1 error. Any help? RRS feed

  • Question


  • I'm trying to insert data from an Access unbounds form to an Access Table using the follwoing code:

    Sub SaveDetails()
        
        Dim xCHI As String
        
        xCHI = Me.txtCHI.Value

        CurrentDb.Execute "Insert into tbl_Patient_Details(CHI) " _
        & "Values(xCHI);"

    End Sub

    On the form, I have an unbound field i.e. the text box name txtCHI and  the following error:

    Run-time error '3061'
    Too few parameters. Expected 1

    Any Help please
    Tuesday, June 9, 2009 7:54 PM

Answers

  • By the way, try changing this

    CurrentDb.Execute "Insert into tbl_Patient_Details(CHI) " _
        & "Values(xCHI);"

    to this
    CurrentDb.Execute "Insert into tbl_Patient_Details(CHI) & Values(" & xCHI & ");"




    If this post is useful, mark it as answer.
    • Marked as answer by Xingwei Hu Tuesday, June 16, 2009 3:09 AM
    Wednesday, June 10, 2009 8:50 AM

All replies