Results 1 to 4 of 4
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Change Tab Caption if No Data? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    I have a Form with a Tab Control

    Tab Control has two Tabs called Permits and Notes

    The two Tabs display a continous form with information from same record

    If the the current reord in the subform has no notes (memNotes) I want to change the Notes caption to no notes.

    I tried putting the following code in the SubForm

    <pre>Private Sub Form_Current()
    If Len(Me.memNotes) > 0 Then
    Me.TabCtl0.Pages(1).Caption = "NOTES"
    Else
    Me.TabCtl0.Pages(1).Caption = "no notes"
    End If
    End Sub
    </pre>



    I’m getting “Method or data member not found” error on TabCtl0

    Me.TabCtl0.Pages(1).Caption = "NOTES"

    How do I get this to work?

    Thanks, John

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Change Tab Caption if No Data? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    In code behind the subform, Me refers to the subform. The tab control is on the main form, I presume, so it is *not* a control on the subform. Hence, Me.TabCtl0 is not valid. You can refer to the main form from the subform as Me.Parent. Try

    Me.Parent!TabCtl0.Pages(1).Caption = ...

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change Tab Caption if No Data? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    That did it!

    I have a 3rd Tab and another SubForm with continous form, the following works OK, is there a better way?

    <pre>If Nz(DCount("lngApplicantID", "tbl_HP_MPW", _
    "lngApplicantID=" & Me.Parent.lngApplicantID & ""), 0) > 0 Then
    Me.Parent!TabCtl0.Pages(2).Caption = "METERED PARKING"
    Else
    Me.Parent!TabCtl0.Pages(2).Caption = "no metered parking"
    End If
    </pre>


  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Change Tab Caption if No Data? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    The code refers exclusively to items on the main form, so there doesn't seem to be a reason for running it from the subform, it would be more efficient to run it from the main form (omitting .Parent, of course).

Posting Permissions

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