Results 1 to 2 of 2

Thread: Run-tim error 3061? Why?

  1. #1
    Pirre001
    Guest

    Question Run-tim error 3061? Why?

    Whats wrong with this? I use the code in in Access.
    I get: Run-time error 3061. To few parameters. Expected 1.
    The form frmTest is open when the code is running.
    VB Code:
    1. Sub GetValue()
    2.  
    3.    Dim DB As Database
    4.    Dim RS As Recordset
    5.    Dim SQL As String
    6.  
    7.    SQL = "SELECT * FROM tblTest WHERE [Field1] = [Forms]![frmTest]![Text3]"
    8.    Set DB = CurrentDb
    9.    Set RS = DB.OpenRecordset(SQL)
    10.  
    11.    Me.Text1.Value = RS.Fields("Field1")
    12.    Me.Text2.Value = RS.Fields("Field2")
    13.    RS.Close
    14.    Set DB = Nothing
    15.  
    16. End Sub

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    try changing to this

    "SELECT * FROM tblTest WHERE [Field1] = '" & frmTest.Text3 & "'"

Posting Permissions

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



Click Here to Expand Forum to Full Width