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