Share via

Using strSQL

Anonymous
2010-08-04T14:17:29+00:00

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

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

11 answers

Sort by: Most helpful
  1. Anonymous
    2010-08-04T20:43:35+00:00

    Daniel,

    Your patience in this issue is greatly appreciated.  I see where you tweaked the SQL to make this work.  I'll bookmark this thread for similar coding issues.  Thank you.

    Was this answer helpful?

    0 comments No comments