• AllowEdits in subforms on tabcontrols (2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » AllowEdits in subforms on tabcontrols (2000)

    Author
    Topic
    #401983

    I have a form which contains a tabcontrol.
    The tabcontrol has a number of tabs.
    Some of the tabs have 2 subforms on them.

    I wish to set the allowadditions, allowedits and allowdeletions on the subforms to false when i open the original form, and have a checkbox to set them to true.

    So far I’ve been struggling with setting the values to false

    I’ve tried

    ProductTabsRecipeSub.Form.AllowEdits = False
    ProductTabsRecipeSub.Form.AllowAdditions = False
    ProductTabsRecipeSub.Form.AllowDeletions = False

    and

    With me.ProductTabsRecipeSub.Form
    .AllowEdits = False
    .AllowAdditions = False
    .AllowDeletions = False
    endwith

    The above was cribbed from another posting on this site

    but to no avail

    Any ideas? In this example, ProductTabsRecipeSub is a subform in a tabcontrol called ProductTabsControl on a form named ProductTabs

    John

    Viewing 1 reply thread
    Author
    Replies
    • #796670

      A subform may not yet be available for manipulation when the main form opens. I would set the Allow Additions etc. properties to No in design view.

      • #796672

        How can I then switch them back on Hans?
        Is the code I am attempting to use correct?

        john

        • #796674

          The code – with False replaced by True – should work to enable additions etc., if you have used the name of the subform as a control on the main form – this is not necessarily the same as the name of the subform in the database window.

          • #796678

            Hans
            Thanks – it worked as you suggested.
            I know it’s sometime not a good idea to ask “why?” but why?
            At what stage is the form available to have all of it’s attributes altered?
            Any thought as to why I can set enabled to false for a particular subform but not allow me to set the allowedit option instead at the same point?
            I’m getting my head around things slowly, but sometimes it just smashes into that brick wall
            John

            • #796685

              When a form with subforms is opened, there has to be interaction between them to start the synchronization between main form and subforms. I don’t know what the exact order of events is. When you disable a subform, you are manipulating the subform as a control, but when you try to set the AllowEdits property, you are manipulating the subform as a form.

            • #796686

              When a form with subforms is opened, there has to be interaction between them to start the synchronization between main form and subforms. I don’t know what the exact order of events is. When you disable a subform, you are manipulating the subform as a control, but when you try to set the AllowEdits property, you are manipulating the subform as a form.

          • #796679

            Hans
            Thanks – it worked as you suggested.
            I know it’s sometime not a good idea to ask “why?” but why?
            At what stage is the form available to have all of it’s attributes altered?
            Any thought as to why I can set enabled to false for a particular subform but not allow me to set the allowedit option instead at the same point?
            I’m getting my head around things slowly, but sometimes it just smashes into that brick wall
            John

        • #796675

          The code – with False replaced by True – should work to enable additions etc., if you have used the name of the subform as a control on the main form – this is not necessarily the same as the name of the subform in the database window.

      • #796673

        How can I then switch them back on Hans?
        Is the code I am attempting to use correct?

        john

    • #796671

      A subform may not yet be available for manipulation when the main form opens. I would set the Allow Additions etc. properties to No in design view.

    Viewing 1 reply thread
    Reply To: AllowEdits in subforms on tabcontrols (2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: