• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 185
  • Last Modified:

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

0
wlwebb
Asked:
wlwebb
1 Solution
 
als315Commented:
Missing & after first chr(34)
Chr(34) & [Me.lstJobCostSummaryJobSelector] & chr(34)
0
 
Armen Stein - Microsoft Access MVP since 2006Commented:
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
0
 
wlwebbAuthor Commented:
Thanks Als315, that was it.  Also had to get rid of the [] on the Me. part of the statement
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now