How to display a current form name

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jamesnkk
    New Member
    • Nov 2006
    • 134

    How to display a current form name

    I have many form with frame, it also have a condition to test whether the frame to be hidden or unhide, so instead of repeating the code in every form, I created a module like this -

    If MAS00 = 1 Then
    FrameMas00.Visi ble = True
    ElseIf MAS00 = 0 Then
    FrameMas00.Visi ble = False
    End If

    I call the module in the form like this -
    modframe

    It return me an error as it does not know this frame is belong to which form, How should I cater for all forms ?
  • jeffstl
    Recognized Expert Contributor
    • Feb 2008
    • 432

    #2
    Originally posted by jamesnkk
    I have many form with frame, it also have a condition to test whether the frame to be hidden or unhide, so instead of repeating the code in every form, I created a module like this -

    If MAS00 = 1 Then
    FrameMas00.Visi ble = True
    ElseIf MAS00 = 0 Then
    FrameMas00.Visi ble = False
    End If

    I call the module in the form like this -
    modframe

    It return me an error as it does not know this frame is belong to which form, How should I cater for all forms ?
    You will need a public function that checks a visibility true\false and returns the boolean.

    Create a public function for your project and then use it where needed

    [code=vb]

    Function CheckFrmVisible (MyInputVar as variant) as Boolean
    Select Case MyInputVar
    Case 0
    CheckFrmVisible = False
    Case 1
    CheckFrmVisible = True
    End Select
    End Function

    'Then place this on any form where needed

    FrameMas00.Visi ble = CheckFrmVisible (MyInputVar)


    [/code]

    Comment

    Working...