Update subform after selection on Main Form

Hi everyone

I am attempting to update a subform after the user selects an item from a list on a mainform

I get an error.

The offending line of code is

    strCriteria = "[GLDataName]  = " & Chr(34) [Me.lstJobCostSummaryJobSelector] & chr(34)

Anyone see what the problem is?
Private Sub lstJobCostSummaryJobSelector_AfterUpdate()
    Dim rs As Recordset
    Dim rsAdd As Recordset
    Dim strCriteria As String
    strCriteria = "[GLDataName]  = " & Chr(34) [Me.lstJobCostSummaryJobSelector] & chr(34)
    Set rs = Me.RecordsetClone
    rs.FindLast strCriteria
    Me.Bookmark = rs.Bookmark
     Me.txtGLDataName = Me.lstJobCostSummaryJobSelector
     Me.txtJob = Me.lstJobCostSummaryJobSelector

End Sub

Open in new window

Who is Participating?
als315Connect With a Mentor Commented:
Missing & after first chr(34)
Chr(34) & [Me.lstJobCostSummaryJobSelector] & chr(34)
Armen Stein - Microsoft Access MVP since 2006PresidentCommented:
Without looking at it in detail, your syntax is off, you're missing an &.

    strCriteria = "[GLDataName]  = " & Chr(34) [Me.lstJobCostSummaryJobSelector] & chr(34)

should be something like:

    strCriteria = "[GLDataName]  = " & Chr(34) & [Me.lstJobCostSummaryJobSelector] & chr(34)

We don't use Chr(34).  You can get the same result by stacking quotes:

    strCriteria = "[GLDataName]  = """ & [Me.lstJobCostSummaryJobSelector] & """"

wlwebbAuthor Commented:
Thanks Als315, that was it.  Also had to get rid of the [] on the Me. part of the statement
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.