Results 1 to 3 of 3

Thread: Sub-Form Help

  1. #1
    Join Date
    Aug 2002
    Posts
    2

    Unhappy Unanswered: Sub-Form Help - Beginner

    Hi, I'm relatively new to MS Access (even newer to this board). Can someone help me tackle a problem? I made a form and embedded a subform inside of it. I want to make this subform invisible using an OnCurrent event if a certain option button is selected. I think my code is correct, but I can't figure out how to reference the sub-form properly. Any help would be appreciated.
    Last edited by BooRadley; 08-01-02 at 01:58.

  2. #2
    Join Date
    Aug 2002
    Posts
    2
    This is what I have so far:

    Private Sub Form_Current()

    If [Frame103] = "1" Then
    [WageRate].Visible = True And MONTHtk.Visible = True
    Else
    If [Frame103] = "2" Then
    [WageRate].Visible = False And MONTHtk.Visible = False
    End If
    End If

  3. #3
    Join Date
    Jul 2002
    Location
    Romania
    Posts
    122
    Your code is basically correct, but with a few inconsistencies:
    No need of double quotes in option values
    Two instructions have to be separated by :, not by And, otherwise you're trying to calculate a logical value:
    [color blue]True And MONTHtk.Visible[/color] results in 0 or -1 (False or true)


    Private Sub Form_Current()
    If [Frame103] ="1" Then
    [WageRate].Visible = True And MONTHtk.Visible = True
    Else
    If [Frame103] = "2" Then
    [WageRate].Visible = False And MONTHtk.Visible = False
    End If
    End If
    MISSING: End Sub

    That's how you should do it:

    Private Sub Form_Current()
    Select Case Frame103
    Case 1
    WageRate.Visible = True
    MONTHtk.Visible = True

    Case 2
    WageRate.Visible = False
    MONTHtk.Visible = False

    Case Else
    'if you have more option buttons in the frame, insert code here
    End Select

    End Sub

    HTH,

    Dan

Posting Permissions

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