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:
Sub GetValue() Dim DB As Database Dim RS As Recordset Dim SQL As String SQL = "SELECT * FROM tblTest WHERE [Field1] = [Forms]![frmTest]![Text3]" Set DB = CurrentDb Set RS = DB.OpenRecordset(SQL) Me.Text1.Value = RS.Fields("Field1") Me.Text2.Value = RS.Fields("Field2") RS.Close Set DB = Nothing End Sub




Reply With Quote