Results 1 to 9 of 9
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Portland, Maine, USA
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Value of control on a tabcontrol subform (2000/SR-1)

    I'm trying to hide/show a picture on a tab page based on the oncurrent of another subform. Here is what I have. A main form with a tabcontrol that has 2 pages. Each page has it's own subform. On the 1st page's subform oncurrent event I want to check and see if there is a record in the 2nd page's subform. If there is I want to display a picture on the 2nd page tab, if not, no picture.
    So basically my main form has a details subform that is on page 1 of a tabcontrol. Page 2 has a subform for comments. If there is a comment I want to indicate to the user that there is a comment or note by displaying a picture on the 2nd page tab. I'm having referencing problems.
    Any help would be greatly appreciated.
    Thanks
    Don

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Value of control on a tabcontrol subform (2000/SR-1)

    Use :
    <pre>If Me.SubformControlName.Form.Recordset.RecordCount > 0 Then</pre>

    You dont have to use the tab control or the page to reference to the subform.
    Francois

  3. #3
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Portland, Maine, USA
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Value of control on a tabcontrol subform (2000/SR-1)

    Francois,
    I tried that but when I type "Me." my subform doesn't show in the list. And if I type it anyway I get the "method or data member not found" error. Also, my subform's recordsource is based on its related table and not a query, if that matters. Any other suggestions?
    Thanks
    Don

  4. #4
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Portland, Maine, USA
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Value of control on a tabcontrol subform (2000/SR-1)

    I'm checking the if there are any records in subform2 from the subform1 OnCurrent event. I believe this is why I'm not seeing subform2 in the list after typing Me. But even when I explicitly reference subform2 like this: Forms!frmMaster!sfrPaymentNotes.Form.Recordset.Rec ordCount>0 it's still not working? hmmm
    I can't seem to figure this out.

    Don

  5. #5
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Value of control on a tabcontrol subform (2000/SR-1)

    It's strange because if you use the same reference in an after update event it works well.
    Maybe it don't works because when subform 1 opens, subform 2 is not yet opened. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>
    Francois

  6. #6
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Portland, Maine, USA
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Value of control on a tabcontrol subform (2000/SR-1)

    Francois,
    Thanks for taking a crack at her. I'll keep hacking away. But my brain is sooo fried! I'm going to rethink this. Maybe I could enable and disable that picture on the tab using a different method. There is probably a better way anyway. If anyone has any thoughts or suggestions let me know.
    Thanks again,
    Don

  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Value of control on a tabcontrol subform (2000/SR-1)

    You can't refer to another subform using the Me keyword. Me refers to the current form (subform), which of course doesn't contain subform2. What you want is Parent!sfrPaymentNotes.Form etc.

    If you want a recordcount, try referencing the subform's recordsetclone instead of its recordset. Then you can test for its EOF to see if it's empty.
    Charlotte

  8. #8
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Portland, Maine, USA
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Value of control on a tabcontrol subform (2000/SR-1)

    I tried using the Parent!sfrPaymentsNotes.Form....but still getting an error when opeing my main form. "Error 2455, you entered an invalid reference to the property form/report." Everything else seems to be setup just fine.
    Thanks for your help!
    Don

  9. #9
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Value of control on a tabcontrol subform (2000/SR-1)

    Where are you trying to use the Parent reference? You can only use it form a subform.

    You're going to have to post the code that is misbehaving. Just trying to describe the error you get doesn't help us figure out why. What does the code actually say and where exactly is the error occuring?
    Charlotte

Posting Permissions

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