Daniel,
Actually yes, that is exactly what I am trying to accomplish here. I need to return a SQL value into a text box located within my subform. Nothing fancy but it is appearing alot more complicated than I originally envisioned.
I have copied your example into my VBA but still have a error. This time, the line: "Set rs =... " is highlighted. Outside of placing break points to pinpoint the problem I am unsure of the best way of troubleshooting this. Your thoughts?
Private Sub Form_Current()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim iCount As Integer
Dim strSQL As String
strSQL = <code entered here>
Set db = CurrentDb()
Set rs = db.OpenRecordset(strSQL) 'open the recordset for use (table, Query, SQL Statement)
With rs
If .RecordCount <> 0 Then 'Ensure that there are actually records to work with
'The next 2 line will determine the number of returned records
rs.MoveLast 'This is required otherwise you may not get the right count
iCount = rs.RecordCount 'Determine the number of returned records
Do While Not .BOF
'Do something with the recordset/Your Code Goes Here
PerfEvalCalc = ![PerfEvalCalc]
.MovePrevious
Loop
End If
End With
rs.Close 'Close the recordset
Set rs = Nothing
Set db = Nothing
Me.txtPerfEvalCalc = PerfEvalCalc
End Sub