Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2006
    Posts
    17

    Display and Empower Multiple Subforms

    Combo boxes cboTN and cboSB are on my main form. cboTN is a search combo box that updates combo box cboSB with one of 3 values (ID, IDC, or MC).

    I would like to do the following:

    1:
    If the after-update value of cboSB is ID, subform sf1 will be visible.
    If the after-update value of cboSB is IDC, subform sf2 will be visible.
    If the after-update value of cboSB is MC, subform sf3 will be visible.
    (only one subform visible at a time since they are stacked in one place on my main form)



    2:
    Once the appropriate subform is displayed, is it possible to use option buttons to set the property of the subform to either Add-only mode or Edit-only mode? If so, how? (perhaps some sort of Case A, Case B scenario with the option buttons?)

    If you can help with either of the above; example codes would help my novice skills greatly!

  2. #2
    Join Date
    Dec 2005
    Location
    Wilmington, DE - USA
    Posts
    275
    In reference to Part 1, here is some code from a project where I had multiple subforms, but wanted to show them conditionally.

    Code:
    Private Sub Form_Current()
    
        WhatToShow
        
    End Sub
    
    Private Sub WhatToShow()
    
        On Error Resume Next
        
        Select Case Forms("frmCapActLv1").Controls("subfrmCapActLv2").Controls("CapActLv2ID").Value
            Case 0
                [CapActLv2Share].Visible = False
                [CapActLv2Share_Label].Visible = False
                [subfrmCapAllocs].Visible = False
                [subfrmCapAllocs_Label].Visible = False
                [subfrmCapAllocsFixed].Visible = False
                [subfrmCapAllocsFixed_Label].Visible = False
                [subfrmCapAllocsAdd].Visible = False
                [subfrmCapAllocsAdd_Label].Visible = False
            Case 1 To 3
                [CapActLv2Share].Visible = True
                [CapActLv2Share_Label].Visible = True
                [subfrmCapAllocs].Visible = False
                [subfrmCapAllocs_Label].Visible = False
                [subfrmCapAllocsFixed].Visible = False
                [subfrmCapAllocsFixed_Label].Visible = False
                [subfrmCapAllocsAdd].Visible = False
                [subfrmCapAllocsAdd_Label].Visible = False
            Case 4
                [CapActLv2Share].Visible = False
                [CapActLv2Share_Label].Visible = False
                [subfrmCapAllocs].Visible = False
                [subfrmCapAllocs_Label].Visible = False
                [subfrmCapAllocsFixed].Visible = True
                [subfrmCapAllocsFixed_Label].Visible = True
                [subfrmCapAllocsAdd].Visible = False
                [subfrmCapAllocsAdd_Label].Visible = False
            Case 5
                [CapActLv2Share].Visible = False
                [CapActLv2Share_Label].Visible = False
                [subfrmCapAllocs].Visible = True
                [subfrmCapAllocs_Label].Visible = True
                [subfrmCapAllocsFixed].Visible = False
                [subfrmCapAllocsFixed_Label].Visible = False
                [subfrmCapAllocsAdd].Visible = False
                [subfrmCapAllocsAdd_Label].Visible = False
            Case Else
                [CapActLv2Share].Visible = False
                [CapActLv2Share_Label].Visible = False
                [subfrmCapAllocs].Visible = False
                [subfrmCapAllocs_Label].Visible = False
                [subfrmCapAllocsFixed].Visible = False
                [subfrmCapAllocsFixed_Label].Visible = False
                [subfrmCapAllocsAdd].Visible = True
                [subfrmCapAllocsAdd_Label].Visible = True
        End Select
    
        On Error GoTo 0
    
    End Sub

  3. #3
    Join Date
    Mar 2006
    Posts
    17
    Patrick,

    Thanks very much for the code. Putting it in the current event of the form is another place that I haven't tried, so am anxious to adapt this and see how it works.

    Any advice on how to tell each subform to function in eith "add" or "edit" mode?

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

Similar Threads

  1. Replies: 0
    Last Post: 10-21-2008, 10:51 PM
  2. Making subforms editable
    By ashiers in forum Forms
    Replies: 7
    Last Post: 10-08-2008, 04:09 PM
  3. Subforms
    By henryclay in forum Access
    Replies: 0
    Last Post: 07-24-2007, 07:51 AM
  4. SubForms to Parent
    By henryclay in forum Forms
    Replies: 2
    Last Post: 10-27-2006, 07:14 AM
  5. Control addressing on subforms
    By JB in forum Access
    Replies: 1
    Last Post: 12-09-2005, 09:14 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