Results 1 to 7 of 7
  1. #1
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496

    referencing to a control property on a subform

    yet again.... I'm stuck ("something" in the syntax is not right)


    (could you plz point me in the right direction)

    Code:
    Public Sub AtticStock(frm As Access.Form)
    'Me!Subform1.Form!ControlName.Enabled
    
        With frm
            With !fsubSpec_AltMfr.Form
    
                'field added 2020.06.08 may not yet have a value; initiate 
                If IsNull(!chkAtticStockYN) Then
                    !chkAtticStockYN = 0
                End If
    
                !txtComplete_QTY!Enabled = !chkAtticStockYN
                !txtComplete_PCT!Enabled = !chkAtticStockYN
                !txtModule_QTY!Enabled = !chkAtticStockYN
                !txtModule_PCT!Enabled = !chkAtticStockYN
                !txtDriver_Qty!Enabled = !chkAtticStockYN
                !txtDriver_PCT!Enabled = !chkAtticStockYN
                !txtTrim_QTY!Enabled = !chkAtticStockYN
                !txtTrim_PCT!Enabled = !chkAtticStockYN
                !txtQtyBasis!Enabled = !chkAtticStockYN
    
            End With
        End With
    End Sub
    as always, with appreciation in advance,
    m.

  2. #2
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,142
    Try .Enabled instead of !Enabled

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,892
    What happens - error message, wrong result, nothing?

    Try using
    .txtComplete_QTY.Enabled
    etc
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496
    .txtComplete_QTY.Enabled = .chkAtticStockYN = application or object defined error
    !txtModule_QTY.Enabled = .chkAtticStockYN = application or object defined error
    !txtDriver_PCT.Enabled = !chkAtticStockYN = can't find the field chkAtticStockYN referred to in your expression
    .txtTrim_PCT.Enabled = !chkAtticStockYN = can't find the field chkAtticStockYN referred to in your expression

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,892
    Suggest you provide db for analysis.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Maybe try getting the code to execute WITHOUT using the "WITH...END WITH" syntax.
    Then start adding the "WITH...END WITH" syntax - one "WITH...END WITH" at a time.
    (small steps, little bites)

    I am very confused about which is the form and which is the sub form......

  7. #7
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,776
    I'd say that if you create a With block, you can DO things with the referenced object, but not manipulating sub objects. The With is with the higher level object not the lower one. It ought to work if it was like

    With frm!fsubSpec_AltMfr.Form

    and then you wouldn't need to nest With blocks either.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 01-09-2018, 05:28 PM
  2. Replies: 3
    Last Post: 10-30-2014, 03:34 PM
  3. Replies: 6
    Last Post: 02-23-2014, 05:53 PM
  4. Replies: 3
    Last Post: 03-29-2013, 02:36 PM
  5. VBA Referencing Subform Control Error 2465
    By Jester0001 in forum Programming
    Replies: 3
    Last Post: 05-30-2012, 07:31 AM

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