Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Apr 2011
    Location
    Canton, MO
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    MS Access 2007 Error 438

    I get this error: Object doesn't support this property or method. Error 438
    I have an OptionGroup on a form, where I am trying to enable/disable some of the option selections based on current data in a table.
    I believe I need to reference the OptionGroup collection's members, but I can't figure out how to do it. The Help is not helpful.

    Code below, screenshot attached.
    Thanks in advance for any help!
    Scott
    -----
    Public Sub LimFormSetVisible_CritSet()
    On Error GoTo ErrHandler
    Dim rstCset As DAO.Recordset
    Dim i As Integer
    Dim j As Integer

    Set rstCset = CurrentDb.OpenRecordset("SELECT Max(T_Global_Local.vIndex) AS MaxOfvIndex FROM T_Global_Local WHERE (((T_Global_Local.vName)='Lim_CritSetValid') AND ((T_Global_Local.vValue)='-1'));", dbOpenSnapshot)
    For j = 0 To 3
    For i = 0 To Forms!F_MainLimiter.Controls.Count - 1
    If Forms!F_MainLimiter.Controls(i).ControlType = acOptionGroup Or Forms!F_MainLimiter.Controls(i).ControlType = acLabel Then
    If Forms!F_MainLimiter.Controls(i).Name Like "???_Lim_CritSet_01_0?" Then
    Forms!F_MainLimiter.Controls(i).Enabled = IIf(j > rstCset!MaxOfvIndex, False, True)
    End If
    End If
    Next i
    Next j
    Forms!F_MainLimiter.Form.Refresh
    Forms!F_MainLimiter.Form.Repaint


    ExitHandler:
    Exit Sub

    ErrHandler:
    MsgBox Err.Description & vbCrLf & "Error Number: " & Err.Number
    Resume ExitHandler
    End Sub
    Attached Images Attached Images

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    You can refer to each of the individual options directly by name.
    I attach a demo that enables/disables options in the OnCurrent event based on the value of one of the fields.


    A note abput my code

    Code:
    Me.Option25.Enabled = (Me.Orders > 20)
    is just a more compact way of writing
    Code:
    me.option25.enabled = IIF(me.orders>20,true,false)
    Attached Files Attached Files
    Last edited by johnhutchison; 2011-04-12 at 19:16.
    Regards
    John



  3. #3
    New Lounger
    Join Date
    Apr 2011
    Location
    Canton, MO
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks John. That set me straight, I've got it working now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •