• Subform (97)

    Author
    Topic
    #369026

    I have a subform which displays multiple records (continuous). On this subform I also have a listbox for displaying data from another table, that is related to the records on the subform. I use a select statement that grabs data based on a field on the subform. This almost works (displays correct data for first detail record). My problem is that this listbox keeps repeating the data related to the first record on the subform. How can I get the listbox to refresh or requery for each detail record?

    Viewing 0 reply threads
    Author
    Replies
    • #579903

      In the On Current event of the subform, enter
      Me.Mycombo.Requery

      • #580087

        Francois, I tried your solution but it still repeats the data related to the first record. Maybe this isn’t possible with continuous records??? My subform is named frmSubTwo, and it displays continuous records based on one query (works fine). This subform also has a list box named List99, which uses a select statement against a different table (but with a related field). As I mentioned before, the data displayed in this list box is correct for the first record, but this same data displays for all subsequent records on the subform. On the ‘On current’ event of the subform (frmSubTwo) I have the code: Me.List99.Requery
        Anything else I should try?

        Thanks for your help.

        • #580091

          I’ve had crazy problems like this in subforms with listboxes and comboboxes not being requeried even though I issue the requery method.

          One thing that worked for me was to programmatically set the RecordSource property for the form and/or RowSource property for the control AGAIN just BEFORE having the line of code doing the requery, i.e.,

          Me.List99.RowSource = “SELECT whatever, etc., etc.”
          Me.List99.Requery

          Let me know if this works for you.

          Stephan

          • #580195

            Adding the Select statement before the requery almost worked. Now I still see the data related to the first record, in each list box, but if I click on any field for a particular detail record, all occurrences of the list box change to display the data related to the “clicked” record. This is better, but I was hoping to be able to automatically display data related to each record, right next to that particular record. Apparently the list box is only “pointing” to one piece of data at a time and just repeating itself for each of the continuous records on the form. This is not how I want this form to look. Any other ideas?????

            • #580208

              You can’t avoid that behavior with a continuous form. Even though it looks like there is a set of controls for each record, there is really only one set so some actions will result in the same information being displayed in all rows. This is particularly true of unbound controls, since they can only be affected by the current record, which is the only one you can actually address.

            • #580374

              Thank you Charlotte and all the other great folks who participate in this wonderful forum.

    Viewing 0 reply threads
    Reply To: Subform (97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: