I have an unbound text box in a subform that I would like to reference information from a query via VBA. When I go from design view to form view my VBA pops up telling me that the line db.Execute strSQL, dbFailOnError is the culprit. When I hover over
this line I do not see a value on strSQL but instead the lengthy SQL code (it should be "1.75"). Any thoughts as to what I am missing on this?
Private Sub Form_Current()
Dim strSQL As String
Dim db As DAO.Database
Set db = CurrentDb
strSQL = "SELECT 0.1666*([tblRLS]![1Opt]+[tblRLS]![2Opt]" _
+ "[tblRLS]![3Opt]+[tblRLS]![4Opt]" _
+ "[tblRLS]![5Opt]+[tblRLS]![6Opt])*0.5" _
+ "0.25*([tblRDS]![CPCDOpt]+[tblRDS]![PDOpt]" _
+ "[tblRDS]![SQSOpt]+[tblRDS]![UOOpt])*0.5 AS PerfEvalCalc " _
& "FROM tblRLS INNER JOIN tblRDS ON tblRLS.EmplID = tblRDS.EmplID;"
db.Execute strSQL, dbFailOnError
Set db = Nothing
Me.txtPerfEvalCalc = strSQL
End Sub