Results 1 to 14 of 14
  1. #1
    3 Star Lounger
    Join Date
    May 2003
    Location
    Sacramento, California, USA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Form Question (A2k)

    I've changed a form to have a main form with 3 subforms set to tab control. I would like the first subform in the group be invisible until clicking on the tab with it's name on it. I've set the subform property to Not Visible and put code in the click event of the tab property sbfStudentClasses.Visible = True.

    When I click on the tab, the subform remains invisible. I have a feeling this has something to do with the tab control itself, but can't figure it out.

    Pleases help-
    Thanks

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

    Re: Form Question (A2k)

    In the first place, why do it that way? It seems pretty useless.

    The On Click event of a tabbed page doesn't work and that of the tab control as a whole is lame (it only fires if you click to the right of the last tab) <img src=/S/crazy.gif border=0 alt=crazy width=15 height=15>

    Instead, use the On Change event of the tab control, and inspect the Value of the tab control; 0 = first tab, 1 = second tab, etc. But this event will only fire if - as the name indicates - the user clicks on a tab that is different from the currently active tab.

    For a tab control named tabPages:

    Private Sub tabPages_Change()
    Select Case tabPages.Value
    Case 0
    Me.sbfStudentClasses.Visible = True
    Case 1
    '...
    Case 2
    '...
    End Select
    End Sub

  3. #3
    3 Star Lounger
    Join Date
    May 2003
    Location
    Sacramento, California, USA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form Question (A2k)

    Hi Hans,

    It's actually only for the aesthetic value, it just looks better that way.

    <<But this event will only fire if - as the name indicates - the user clicks on a tab that is different from the currently active tab.>>
    So does this mean that there will always be a visible form?

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

    Re: Form Question (A2k)

    >> So does this mean that there will always be a visible form?

    I assume that you mean subform. That is up to you, as programmer. Just like you can make subforms visible, you can hide them too. Just set .Visible = False where you need it.

  5. #5
    3 Star Lounger
    Join Date
    May 2003
    Location
    Sacramento, California, USA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form Question (A2k)

    You assumed correct. Thanks Hans
    <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>

  6. #6
    3 Star Lounger
    Join Date
    May 2003
    Location
    Sacramento, California, USA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form Question (A2k)

    I have something bizarre happening that I cannot figure out.

    I have one complete record entered in my database. This includes the personal info on the main frmParticipants, the class info on the sbfStudentClasses, the guest info on the sbfGuests and the payment info on the sbfBilling.

    When I go to add another record, the participant info goes in okay, but when I go to enter the class info, I only have an outline of the form, with it's labels. I can't add any records, there are no record navigation buttons. The other two subforms are behaving properly.

    Any ideas?

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

    Re: Form Question (A2k)

    Please post a stripped-down version of the database again. You know the routine by now <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

  8. #8
    3 Star Lounger
    Join Date
    May 2003
    Location
    Sacramento, California, USA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form Question (A2k)

    Here ya go
    Attached Files Attached Files

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

    Re: Form Question (A2k)

    Gabi,

    Some time ago, you asked for code to make it impossible to have a student participating in more than three classes. This code is in the On Current event of the subform. You also need code to reset this when you move to another record in the main form (frmParticipants), otherwise you'll be stuck with a subform that doesn't allow new records. This code will be in the On Current event of the main form:

    Private Sub Form_Current()
    Me.sbfStudentClasses.Form.AllowAdditions = True
    End Sub

    It may seem that you can add a new record in the subform, even if there are three records already, but as soon as you leave the first record in the subform, that will be corrected.

  10. #10
    3 Star Lounger
    Join Date
    May 2003
    Location
    Sacramento, California, USA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form Question (A2k)

    Thank you soooo much Hans!

    BTW, I was looking at WWW.Holland.com-What a beautiful place to live!

  11. #11
    3 Star Lounger
    Join Date
    May 2003
    Location
    Sacramento, California, USA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form Question (A2k)

    After adding another record to my table, with all the main form and all three subforms populated, I got the following error message:

    "The changes you requested to the table were not successful because they would create duplicate values in the index, primary key or relationship. Change the data in the field or fields that contain duplicate data, remove the index or redefine the index to permit duplicate entries and try again."

    I checked the indices on each of my tables and the only indexed fields are the primary keys. <img src=/S/brickwall.gif border=0 alt=brickwall width=25 height=15>

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

    Re: Form Question (A2k)

    Gabi,

    You'll have to change qryBilling and the fields that link the subform to the main form, for as it is now, the StudentBilling table doesn't get populated.

    Add StudentBilling to qryBilling and add intParticipantID and intBillingID from StudentBilling to the query grid (see screenshot). Save the query.

    Open the main form in design view, activate the Apply a Payment tab and click once on the subform in the tab.
    Activate the Data tab of the Properties window. Make both Link Child Fields and Link Master Fields contain intParticipantID.

    This links the subform correctly to the main form.
    Attached Images Attached Images

  13. #13
    3 Star Lounger
    Join Date
    May 2003
    Location
    Sacramento, California, USA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form Question (A2k)

    I have another question about my forms:

    I need to account for Guests and the cost of the Guests on sbfBilling. I'm trying to determine the best way to accomplish this. One student can have many guests, and the cost associated with the guests may differ. For example a doc who registers before a certain date gets a discount. If he registers a guest(s) at that time it would be one rate. If the same doc decides to register another guest(s) after the "early bird" deadline, the price for that guest would be higher. These guest prices have all been accounted for in my tblPricing.

    What I need to know is how best to go about this. I don't want to add more comboboxes to account for all possible guests and their different rates on the sbfBilling-I think I can tie this information from sbfGuests, where I've added a cboGuestType. I want just a final result on the sbfBilling of the number of guests for that particular intParticipantID. Basically have the control on the sbfBilling already populated with the guest info. <img src=/S/help.gif border=0 alt=help width=23 height=15>

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

    Re: Form Question (A2k)

    Re-posted as <post#=279181>post 279181</post#>, so all reactions there please. I am locking this thread.

Posting Permissions

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