Results 1 to 9 of 9
  1. #1
    Pbear88 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    May 2017
    Posts
    26

    Trying to get second level subform to act like split form


    I’m trying to get a second level subform to act like a split form (where you click (or double click) a datasheet view and it brings that record to the current details view. I have a main form (MainInjuryForm) that has a Subform (InjurySubForm). They are linked Parent-Child with PatientID. There is a PatientInfo Table and an InjuryTable that has a one-many relationship.
    The InjurySubForm is a single record view, but I have also added another subform (InjuryHistoryForm) that is a datasheet view within the InjurySubForm. Those two subforms are also linked Parent-child with PatientID (just one with a single form and one with a datasheet form). I want to be able to click on a record in the datasheet view and have it bring the details to the current view of the InjurySubForm. The field that should be dependent on this action is the InjuryID field, since it is the main identifier in both subforms. Is this possible with this structure? MainForm
    Subform1
    Subform2

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,411
    Think I have got this right. You have

    MainInjuryForm>InjurySubForm>InjuryHistoryForm

    1. if so, it would be better to go

    MainInjuryForm>InjuryHistoryForm>InjurySubForm

    and make your InjuryHistoryForm a continuous form and put the InjuryHistoryForm in the header or footer. You may get a warning, but just ignore it


    2. if you want to stick to your layout, try the following - not tested so not sure it will work

    a.make the child/master values for the InjuryHistoryForm subform control PatientID

    b. in the InjuryHistoryForm current event put

    me.parent.filter="InjuryID=" & me.InjuryID
    me.parent.filteron=true


    3. Another alternative is to have both InjurySubForm InjuryHistoryForm as subforms on your MainInjuryForm

    a. Then on your MainInjuryForm have a hidden control called say txtInjuryID

    b. make the child/master values for the InjuryHistoryForm subform control PatientID
    c. make the child/master values for the InjurySubForm subform control InjuryID/txtInjuryID respectively

    d. in the InjuryHistoryForm current event put

    me.parent.txtInjuryID= me.InjuryID

  3. #3
    Pbear88 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    May 2017
    Posts
    26
    Thanks Ajax. I tried the 2nd suggestion, but it didn't work. On running the Mainform, it would ask for a parameter value for "sFilter". When I clicked ok, the records on the InjuryHistorForm would blank out.

    I'll try your 3rd suggestion next.

  4. #4
    Pbear88 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    May 2017
    Posts
    26
    Ajax, the 3rd suggestion worked for the current records. But now when I'm trying to add a new record through the InjurySubForm, it doesn't assign the new record a value for the PatientID field in the InjuryTable. Any suggestions on how to auto populate that with the new child/master settings that we now have established?

  5. #5
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,411
    would ask for a parameter value for "sFilter".
    Think you must have spelt filter wrong

    Any suggestions on how to auto populate that with the new child/master settings that we now have established?
    linkchild/master properties can have more than one field

    cant remember what the separator is, either a comma or a semi colon, so something like

    linkmaster - patientID;txtInjuryID
    linkchild - patientID;InjuryID

    If that doesn't work, go back to version2, think you just had a typo

  6. #6
    Pbear88 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    May 2017
    Posts
    26
    Thanks Ajax,

    Version 2 worked. I still had a Filter in the properties that I forgot about, when I was trying to figure this out before my initial post. Thank you so much, again! I'm sure I'll be back. It's a pretty extensive project that I'm trying to work through, but a great learning experience.

  7. #7
    Pbear88 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    May 2017
    Posts
    26
    Just ran into a secondary issue with Version 2. Once I click on the datasheet subform and the current record is displayed in the single form(details) view, I would like the clients to have the ability to edit the current record that is displayed. I created a button and in the event procedure for the OnClick method, I put in the code: Me.AllowEdits = True. Now, when I click on the button, it jumps to the first record instead of the current record that was displayed. What do I need to add to the button to make it stay on the current record that I have chosen to be displayed in the single form(details) view?

    Thank you for any assistance.

  8. #8
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,411
    In short I don't know, I would have used option 1, in which case it would not be a problem. Option 2 was untested and could well have problems once you move from the original 'brief'.

    My guess would be that by changing the allow edits property, you are disabling the filter. So you would need to reenable it after changing the property. this might be something like copying the me.filter property to a temporary string, changing the allowedits property, then copying back afterwards and setting filteron, or might just mean setting filteron. You'll need to experiment.

    An alternative might be to set all controls locked property to true, then setting them to false when the button is clicked.

  9. #9
    Pbear88 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    May 2017
    Posts
    26
    Ok. Thank you. I'll try your suggestions tomorrow.

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

Similar Threads

  1. Replies: 3
    Last Post: 03-23-2016, 04:00 PM
  2. Replies: 2
    Last Post: 05-09-2014, 03:01 PM
  3. Replies: 1
    Last Post: 04-14-2014, 01:38 PM
  4. Reset Page Number in a Split Form with a Subform
    By Greg Lemaster in forum Forms
    Replies: 3
    Last Post: 08-09-2012, 02:04 PM
  5. Replies: 8
    Last Post: 06-30-2010, 10:57 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