Results 1 to 10 of 10
  1. #1
    keith01 is offline Novice
    Windows 10 Office 365
    Join Date
    Jun 2023
    Posts
    10

    Sub-Foms in main form Footer, enable scrolling ?

    Good Morning,

    I wish to place two sub-forms on a continiuos master form, and having read through previous posts both on here and on the net in general, it seems the common consensus is to place the two sub-forms in the footer part of the main form to get around the problem of access not allowing sub-forms on continious forms.

    This Works fine, but with two problems, the first is that i am unable to scroll the footer part of the form (there is no scroll bar), and the second is that there is a huge gap on the form between the "detail" section and the "footer" section of the main form, even though in design view the two are right up against each other.

    I attach the DB in Question, would anybody be able to point out where I am going wrong ?



    Many Thanks in advance

    Database1.zip

  2. #2
    Join Date
    Apr 2017
    Posts
    1,680
    I have put 2 (or more) continuous forms as subforms into unbound main form (it can have tab control too, in case you need it).
    Secondary subforms are linked with primary subform(s) current record. For linking I have used hidden text box(es) in unbound main form, which are updated by OnCurrent and AfterUpdate events of primary subform(s). Lately I was adviced (in some posting in some of Access forums here), that it is possible to link secondary subform directly to current record of primary subform, but I haven't this tested.

  3. #3
    keith01 is offline Novice
    Windows 10 Office 365
    Join Date
    Jun 2023
    Posts
    10
    Quote Originally Posted by ArviLaanemets View Post
    I have put 2 (or more) continuous forms as subforms into unbound main form (it can have tab control too, in case you need it).
    Secondary subforms are linked with primary subform(s) current record. For linking I have used hidden text box(es) in unbound main form, which are updated by OnCurrent and AfterUpdate events of primary subform(s). Lately I was adviced (in some posting in some of Access forums here), that it is possible to link secondary subform directly to current record of primary subform, but I haven't this tested.

    Hi ArvilLaanemets,

    That is one option i looked at, unfortunately, the two subforms are filtered, so by placing a single record number on the Main form and linking it, the filter would no longer work (It took a lot of fiddling to discover this !)

    Regards

    Keith

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Quote Originally Posted by keith01 View Post
    Hi ArvilLaanemets,

    That is one option i looked at, unfortunately, the two subforms are filtered, so by placing a single record number on the Main form and linking it, the filter would no longer work (It took a lot of fiddling to discover this !)

    Regards

    Keith
    Subforms are generally filtered from the main form?
    That is the whole point of them as far as I was aware?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    Join Date
    Apr 2017
    Posts
    1,680
    Quote Originally Posted by keith01 View Post
    That is one option i looked at, unfortunately, the two subforms are filtered, so by placing a single record number on the Main form and linking it, the filter would no longer work (It took a lot of fiddling to discover this !)
    You link secondary subform to unbound control in main bound/unbound form.

    An example:
    The Main form is bound single one (for this example), with fForm0 as source. fForm0 is based on table Table0, with PK Table0ID.. The 1st continuous subfrom is sfForm1, with fForm1 as source. fForm1 is based on table Table1, with PK Table1ID, and FK fkTable0ID. The 2nd continuous subform is sfForm2 , with fForm2 as source. fForm2 is based on Table2, with PK Table2ID, and with FK fkTable1ID. In fForm0, you have a hidden textbox txtTable1ID, which is updated with Table1ID of active row in Form1, whenever you update a record in Form1, or select there another record.

    You set up the 1st subform as usual:
    LinkMasterFields = 'Table0ID'
    LinkChildFields = 'fkTable0ID'

    You set up the 2nd subform as:
    LinkMasterFields = 'txtTable1ID' -- The link is defined through hidden control in main form, not through primary key of Table1! What is logical, as fForm0 doesn't know anything about Table1, and technically sfForm2 is subform of fForm0!
    LinkChildFields = 'fkTable1ID'

    NB! For 2nd subform, you can't use wizard, i.e. you have to define the connection manually!

  6. #6
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    @WGM - Not always, I have a number of forms where there are subforms that are not always linked to anything, it's just a better way to display the data. e.g. two subforms side by side.
    Generally one subform controls what the other displays, but there is no link to the main "holding form".
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  7. #7
    keith01 is offline Novice
    Windows 10 Office 365
    Join Date
    Jun 2023
    Posts
    10
    Quote Originally Posted by ArviLaanemets View Post
    You link secondary subform to unbound control in main bound/unbound form.

    An example:
    The Main form is bound single one (for this example), with fForm0 as source. fForm0 is based on table Table0, with PK Table0ID.. The 1st continuous subfrom is sfForm1, with fForm1 as source. fForm1 is based on table Table1, with PK Table1ID, and FK fkTable0ID. The 2nd continuous subform is sfForm2 , with fForm2 as source. fForm2 is based on Table2, with PK Table2ID, and with FK fkTable1ID. In fForm0, you have a hidden textbox txtTable1ID, which is updated with Table1ID of active row in Form1, whenever you update a record in Form1, or select there another record.

    You set up the 1st subform as usual:
    LinkMasterFields = 'Table0ID'
    LinkChildFields = 'fkTable0ID'

    You set up the 2nd subform as:
    LinkMasterFields = 'txtTable1ID' -- The link is defined through hidden control in main form, not through primary key of Table1! What is logical, as fForm0 doesn't know anything about Table1, and technically sfForm2 is subform of fForm0!
    LinkChildFields = 'fkTable1ID'

    NB! For 2nd subform, you can't use wizard, i.e. you have to define the connection manually!
    Hi Arvil,

    I have been trying to get the above to work all morning, but you have totally lost me !

    I have one main form (Frm_ANET) and two sub forms (Frm_L & Frm_R). The reason for two identical sub-forms is that they both use the same table, frm_L is filtered for "L" and frm_R is filtered for "R", thereby creating two sub-forms from the same table. The underlying table (Frm_Anet) has a primary key of "Photo_ID", so this is going to be the only linking factor for the two sub-forms to use (?) with this in mind, which is the text boz source i place on the main form ?

    Regards

    Keith

  8. #8
    Join Date
    Apr 2017
    Posts
    1,680
    Quote Originally Posted by keith01 View Post
    ... they both use the same table, frm_L is filtered for "L" and frm_R is filtered for "R", thereby creating two sub-forms from the same table. The underlying table (Frm_Anet) has a primary key of "Photo_ID", so this is going to be the only linking factor for the two sub-forms to use (?) with this in mind, which is the text boz source i place on the main form ?
    When Frm_Anet.Photo_ID is a single-field PK of table Frm_Anet, then there can be a single row in this table with specific Photo_ID. So unless you want in second subform the same record, which is active in first subform, to be displayed, in second subform you want to get some records from same table with totally differnt Photo_ID's. This means, you must have some rule, which determines which records must be displayed in second subform. To determine which records, you must:
    a) have some other field or combination of fields to determine this, and to have this field or fields in sources of both forms present. Then you must have (hidden) textbox controls in main form for every of those fields, and to refer to those textboxes;
    b) have no result.

  9. #9
    keith01 is offline Novice
    Windows 10 Office 365
    Join Date
    Jun 2023
    Posts
    10
    Quote Originally Posted by ArviLaanemets View Post
    When Frm_Anet.Photo_ID is a single-field PK of table Frm_Anet, then there can be a single row in this table with specific Photo_ID. So unless you want in second subform the same record, which is active in first subform, to be displayed, in second subform you want to get some records from same table with totally differnt Photo_ID's. This means, you must have some rule, which determines which records must be displayed in second subform. To determine which records, you must:
    a) have some other field or combination of fields to determine this, and to have this field or fields in sources of both forms present. Then you must have (hidden) textbox controls in main form for every of those fields, and to refer to those textboxes;
    b) have no result.

    Hi Arvil

    Many Thanks for taking the trouble to help me with this, I think I have it sorted now

    Best Regards

    Keith

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Never mind.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 06-16-2017, 02:47 PM
  2. Replies: 8
    Last Post: 10-10-2016, 06:07 AM
  3. Replies: 19
    Last Post: 08-31-2016, 12:32 PM
  4. Replies: 4
    Last Post: 02-11-2016, 11:22 AM
  5. Replies: 6
    Last Post: 12-23-2013, 07:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums