Results 1 to 8 of 8

Thread: Blank subform

  1. #1
    DavidMadge
    Guest

    Blank subform

    Hi.
    I'm sure I've seen answers to a problem like this but can't find them now.

    I have two subforms, one of which was made by copying the other and changing only the reference to the query it is based on. Query1 returns two fields from a table, with the records filtered by criteria based on the values of textboxes on my main form. Query2 returns the same fields from the same table, but only those records that are unmatched by those in Query1.

    If I run the queries manually or open the subforms manually, and enter the textbox values when asked, I get the correct output. When I open the main form, the first subform remains blank even when it is requeried. The second subform shows all the records (all unmatched).

    The textboxes, queries and subforms are uniquely named and I've double-checked all references to them. I'm sure I've missed something simple but am looking too hard to see it. Any suggestions?

    David

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Blank subform

    What happens if you remove the record source from your second subform? Does the first one show records? It sounds like you might have a problem with the order in which the subforms are loading. What happends if you issue a Me.Repaint in the OnCurrent event of the main form?
    Charlotte

  3. #3
    DavidMadge
    Guest

    Re: Blank subform

    Thanks for your reply, but...

    Removing the recordsource and using Me.Repaint didn't help. I even deleted the second subform entirely from the main form but the first subform is still blank.

    When I inserted a listbox on the main form and populated it from the query used by the first (blank) subform, the listbox showed the correct records. Is that any help ?

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Blank subform

    It sounds like there might be something wrong with the master and child links between your main form and subform. Have you checked them?
    Charlotte

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    352
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Blank subform

    Try putting a listbox on your form and populating it with the value of the textboxes in the main form. This will establish whether those values are being picked up correctly. Use code as similar as possible to the code you use to provide the parameters to the queries.
    David Grugeon
    Brisbane Australia

  6. #6
    DavidMadge
    Guest

    Re: Blank subform

    Thanks for your suggestions so far people but I'm still not getting anywhere. I'm sure it shouldn't be this difficult, so I'll go back to basics and describe just what I want to do.

    I have a main form (frmMain) which carries a subform (fsubContacts) and two textboxes (txtCert and txtProp). fsubContacts is populated from the query qfltContacts which filters records from tblContact (peoples' contact details) using txtCert and txtProp in its criteria. tblContact and qfltContacts both include the field 'ContactCode' (autonumber).

    tlkpContactFunctions contains the two fields 'ContactFuncCode' (autonumber) and 'ContactFunction' (string). tblContactLinks links tblContact and tlkpContactFunctions by including the fields 'ContactCode' and 'ContactFuncCode'.

    The relationship between tblContacts:tblContactLinks and tlkpContactFunctions:tblContactLinks is 1:many in both cases.

    What I want to do is have a new subform on frmMain or fsubContacts, to be a window into tblContactLinks for editing purposes and be bound to the 'ContactFuncCode' field in that table but show the related 'ContactFunction' field from tlkpContactFunctions. ie for a particular tblContact record, it would show a list of the 'ContactFunctions' connected with that record through tblContactLinks.

    fsubContacts works fine, and when I put extra textboxes on frmMain and fsubContacts they show the correct values for txtCert, txtProp and ContactCode (from fsubContacts). No matter how I've tried to configure it, my new subform seems unable to pick up the value of ContactCode, even when I refer it clearly to a textbox containing the correct value, eg Forms!frmMain![txtContact]. When I replace this reference by a number, eg '1' the correct values for contact 1 are displayed.

    I've tried with master-child links in place (after double-checking their values) and without them (with the record synchronisation being done in a query). Do m-c links work between subforms and sub-sub forms (what I need) or only main forms and sub forms ?

    What is the correct way to do all this ?

    David

  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Blank subform

    What is your main form populated from? Is it unbound? If it is, then you're definitely doing this the hard way. You would not need a reference to fields on the main form in qfltContacts if you used the master and child link properties of the subform control. Each record on the main form would automatically filter the subform records based on the link. If you nest a subform in a subform, you can use master and child links between the subform and the nested subform. If you put the second subform on the main form, you can only link it to the main form.

    You're referring to Forms!frmMain![txtContact] in your example, it wasn't clear that this control exists on your main form. If it is a control on a subform, you have to reference it as Forms!frmMain!fsubContacts![txtContact].
    Charlotte

  8. #8
    DavidMadge
    Guest

    Re: Blank subform

    Thanks Charlotte - your reply prompted me to redesign my db and all my master/child links. I now have my main form based on a query that provides all (9) fields required to synchronise all my subforms - how it should have been from the start (I originally had the main form bound to the Members table). All that is working OK but I have new questions (will post shortly). Thanks again.

Posting Permissions

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