Results 1 to 5 of 5
  1. #1
    Join Date
    May 2002
    Posts
    6

    Post Unanswered: Requerring Subform Issue

    I have created a form with an unbound subform. I am populating the subform with a form query. The query is changed based off the data selected on the main form. Example... I select value 123 on frmMain, this value is updated as criteria in the subform query. Once this subform query is updated I issue the code:

    frmSubForm.Requery

    This of course does not refresh the subform. I have also tried the below pieces of code to no avail:

    Me!frmKeywordSub.Requery
    Me.Parent!frmMain!frmKeywordSub.Requery 'Refer to parent form
    Me.Parent!frmMain!frmKeywordSub.Repaint 'Repaint the subform
    Me!frmKeywordSub.Requery
    Me!frmKeywordSub.Refresh
    Forms("frmMain")("frmKeywordSub").Requery
    DoCmd.Requery (Forms!frmKeywordSub.cmbActions)
    Forms!frmMain!frmKeywordSub.Requery
    Forms!frmMain!frmKeywordSub.Refresh

    Can anyone give a suggestion is this is even possible to refresh/requery this form or if maybe my syntax is not correct.

    Thanks!

  2. #2
    Join Date
    Apr 2002
    Location
    Germany
    Posts
    228
    try:

    Me.NameOfSubFormControl.Form.Requery

  3. #3
    Join Date
    May 2002
    Posts
    6

    More Information

    Thanks for the suggestion...

    I tried your statement and found the below does work:

    Me!SubForm.Requery

    The issue I am having still remains though. It appears the Requery is not the issue. It works after I sort the records on the SubForm. This is really wierd, but it seems I have to "prime" or "initilize" the subform to get it to work. Let me describe:

    When the main form is first opened the subform is visible=false. I select my value on the mainform which changes the query for the subform, then I use a button to toggle the subform into view. It seems to not work until I right click on the form, sort the records as acending or decending, then when I move from selection to selection on the main form the subform requiries correctly each and every time.

    Does anyone know what happens when I sort the records to make this functionality work? If I need to initilize the records how would I go about this?

    The plot thickens....

  4. #4
    Join Date
    Apr 2002
    Location
    Germany
    Posts
    228
    That's odd. Sorting will result implicically to a requery.

    The issue you encounter might be related to the visible property. Maybe the requery won't be performed when the form's not visible and the state is not correctly updated when you set it to visible. What I'd suggest is you set the recordsource of the subform to empy (make it unbound) and set it after the form is set to visible. Setting the recordsource will also result in an implicit requery. In what way are you modifying the recordsource of the subform? How do you set the recordsource of the subform currently?

  5. #5
    Join Date
    May 2002
    Posts
    6

    Ok, this is wierd...

    This is one of those things that you just go, DOH!

    My query issued to populate the subform did not have an order by command. I added the order by to my query and shebang, it works!

    Apparently, Access needs the order by to make the initial requery of the form. This fix will work for my purposes since I needed to order my returned values anyway, but if anyone can explain this qwirk, please indulge me.

    Thanks for your help!

Posting Permissions

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