Page 1 of 2 12 LastLast
Results 1 to 15 of 24

Thread: SubForm Links

  1. #1
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SubForm Links

    Okay..

    So i've setup my subform to link parent and child fields. BUT..

    I have a listbox which ideally I would use to select various schools for credentialing purposes. However, when I select a new school, it fails to update the rest of the sub-form, or the parent data. What can I do to make this happen?

    thanks!
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: SubForm Links

    Where is the listbox, on main for subform? I don't quite understand the situation, but you will have to force a requery of the subform. If you on the mainform, you can requery the subform via it's control name:
    subformControlName.Requery

    On the subform, just do:
    Me.requery
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SubForm Links

    The listbox is on the subform...

    When I have the subform open alone, it works, no problem. Click an item in the list, records update, i'm a happy camper. It's when attempting to display it in the main form that I run into problems.. Nothing is updated.

    The relational structure is such that only one key is used to determine what school i'm selecting... Perhaps I need to update that?

    I'm at a LOSS.. <img src=/S/dizzy.gif border=0 alt=dizzy width=15 height=15> thanks for all your help! <img src=/S/wink.gif border=0 alt=wink width=15 height=15>
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

  4. #4
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: SubForm Links

    Whenever a subform works only when opened by itself, that usually means that you have made a reference to Forms!SubFormName that is NOT valid when it is actually a subform.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  5. #5
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SubForm Links

    Okay.. so how can I make my subform update when I select an item from a list or combo box?

    The update is using this code:

    Sub LstSchool_AfterUpdate()
    ' Find the record that matches the control.
    Me.RecordsetClone.FindFirst "[SchoolID] = " & Me![LstSchool]
    Me.Bookmark = Me.RecordsetClone.Bookmark
    End Sub

    I'm not quite clear what it is about the form/sub-form relationship that makes this code invalid.. can you help?

    Thanks!
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

  6. #6
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Tennessee
    Posts
    194
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SubForm Links

    have you tried this
    me.requery
    at the end of your code

  7. #7
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SubForm Links

    Nope..

    The act of placing these forms as subforms is nullifying the code...

    any help would be greatly appreciated!

    Thanks!
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

  8. #8
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: SubForm Links

    Assuming that the listbox or combo box is the "master" link in the connection between the mainform and the subform, just put a line of code in the AfterUpdate event of the list box that requeries the subform control:
    Me.subformControlName.requery
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  9. #9
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SubForm Links

    Thanks for all your help, but this isn't quite working..

    My list box is on the sub form, I used the list box wizard to specify that I want my listbox to find data in my subform. But, when I click on an item in my listbox, nothing happens.

    The code to update the rest of the sub-form is already in the afterupdate event, so when I add the line you've specified, all it does is requery the listbox. If I make it requery the subform, it tells me it doesn't recognize the control.

    This may be a flaw in design, if you feel it is, please let me know, I'll have other questions on this, For Example, I've got the link parent and link child properties set on the subform, but what happens if I want to change these properties?

    I haven't troubleshooted? this extensively yet, as I'm looking to correct the list box problem to verify that my child/parent linked fields will update when the requested change is made...

    Thanks again for all your help!
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

  10. #10
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Tennessee
    Posts
    194
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SubForm Links

    have you tried using a query in the subform with the list box as the criteria

  11. #11
    New Lounger
    Join Date
    Dec 2000
    Location
    Rockhampton, Queensland, Australia
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SubForm Links

    I usually place the list/combo box on the main form to select whatever record I require, the subform data automatically displays provided the parent child fields are set correctly.
    It seems to me you're trying to work back to front, finding one record from many rather than many from one. It may be able to be done but I've never tried.

  12. #12
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SubForm Links

    My relational structure wouldn't let that work...

    I have [schoolID] there is only one school for each SchoolID, however many doctors may have the same school id.

    When I pull up a doctor, it grabs the corresponding school, but only from existing data. Because there is no link when I add new data, I am unable to specify the school the doctor graduated from.

    Does anyone have some insight on how to correct this problem?

    Thanks!
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

  13. #13
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: SubForm Links

    The code you listed before should work if the listbox is on the subform:

    Sub LstSchool_AfterUpdate()
    ' Find the record that matches the control.
    Me.RecordsetClone.FindFirst "[SchoolID] = " & Me![LstSchool]
    Me.Bookmark = Me.RecordsetClone.Bookmark
    End Sub

    There are a couple of things that could, however, that might prevent it from working. Is [SchoolID] a number? Also, and probably most important, your listbox must have as it's rowsource a query which will produce the same recordsource as the subform! If the listbox has items not in the subforms recordset, then it can't find those items.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  14. #14
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SubForm Links

    Yep.. School ID is a number..

    I'll check on that... You're suggesting I add the 'schoolID' as a field in my listbox, and 'hide' it as it is the primary key.. right?
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

  15. #15
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SubForm Links

    <P ID="edit"><FONT SIZE=-1>Edited by DrkRealm on 18-Jun-01 19:56 (server time).</FONT></P>the list box properties are such that SchoolID is listed, it's width is 0" to hide it. SchoolName is listed, wide enough for it to appear to be the only thing listed in the box.

    The bound column is 2, (schoolname) i've change it to 0, and 1, but am getting errors "Object not found" when I attempt to select a record...

    this works as it should when it is opened by itself, but fails when it's included as a sub-form.

    Any ideas?
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

Page 1 of 2 12 LastLast

Posting Permissions

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