Link to home
Start Free TrialLog in
Avatar of wlwebb
wlwebbFlag for United States of America

asked on

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)
    
    Me.Requery
    Set rs = Me.RecordsetClone
    rs.MoveLast
    rs.FindLast strCriteria
    Me.Bookmark = rs.Bookmark
    
     Me.txtGLDataName = Me.lstJobCostSummaryJobSelector
     Me.txtJob = Me.lstJobCostSummaryJobSelector

End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of als315
als315
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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] & """"

Cheers,
Armen
Avatar of wlwebb

ASKER

Thanks Als315, that was it.  Also had to get rid of the [] on the Me. part of the statement