Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22
  1. #16
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    One would think the compiler would know me well enough to realize I was in "meant to" mode



    The problem turned out to be that the property sheet for the controls involved had their Tag property set to "HL?", so the code needed to wrap ctl.Tag to """HL?""" when inquiring its value.

    Thanks Paul and ridders52

  2. #17
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You have to use Like with a wildcard, not =.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #18
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Oops, didn't see there was a second page. Glad you got it sorted Bill.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #19
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    Why the wildcard? Doesn't ctl.Tag Like "HL?" get the job done?

  5. #20
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    Below is the function I finished with:

    Code:
    Private Function ChgCount() As Integer
    '*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
    '*  Fields of interest have their Tag property set to the string "HL?".  Loop through
    '*  the current form's controls collection and examine the TRUE/FALSE state of its
    '*  "Chg" companion in the current record and add to the count if found to be TRUE.
    '*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
    Dim ctl As Control
    
    ChgCount = 0
    
    For Each ctl In Me.Controls
        If ctl.Tag = """HL?""" Then
            If Me(Replace(ctl.Name, "tb", "chg")) Then _
            ChgCount = ChgCount + 1
        End If
    Next ctl
    
    End Function

  6. #21
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I misunderstood, "?" is a single character wildcard and I thought you were trying to match anything with HL and a single extra character.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #22
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    I use the tag property regularly.
    Suggest you don't use " or ? as part of a tag value.
    Why not just use HL as the tag?
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 01-05-2018, 04:45 PM
  2. Replies: 2
    Last Post: 06-28-2017, 06:16 PM
  3. Replies: 5
    Last Post: 02-08-2017, 05:52 PM
  4. Replies: 2
    Last Post: 06-30-2016, 06:38 PM
  5. Replies: 2
    Last Post: 04-15-2014, 01:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums