• forms-repeating dates (97/SR2)

    Author
    Topic
    #387581

    I have a form that lists files according to dates. Is there a way to stop the form from repeating the same date over and over again. I want the date shown once, then all the files for that date. Then next date … Easy to do on a report. How do you do it on a form?

    Viewing 0 reply threads
    Author
    Replies
    • #676857

      I don’t know if this is the answer for you… but personally I’d use a subform control…
      For example: The main form would be in Single Form view with the Date control in the Detail section…. Then I would place a subform control into the detail section… The subform would be in Continuous Forms view, showing the file data, linked on the Date field…

      Does that help at all??

      • #676862

        That won’t work because you can not have a continuous form that contains a subform. I want the form to show several dates with related files under each date just like a report.
        Thanks for the idea.

        • #676876

          You’re not going to like this, but I think you should reconsider your setup. Forms and reports have different purposes. Bound forms are for enterig. editing and viewing data. Each record must be complete. Reports are for presenting and summarizing data. In a report it makes sense to hide repeating data, in a form it doesn’t. By trying to make a form look like a report, you are trying to make it do something it wasn’t designed for.

        • #676879

          Could a Treeview control do what you want?
          I’ve never used one myself but there are several threads in the Lounge about them.

          Just a thought. shrug

        • #676886

          Paul,

          I agree with Hans 100%. However, if you HAVE to have this information on a form (rather than a report), one way to get what you want would be to create a temporary table (using a Make Table query) cloning your source table (list of file names and dates) with an added “dteNewDate” Date/Time field and with the records ordered the way you want them to appear in the form. Then use VBA code to scan through this table’s records (or through the results of an updatable query that orders the records the way you want them) and assign the Date field’s value to dteNewDate field if and only if the previous record’s date is different. Use this temporary table as your recordset for the form and dteNewDate as the Control Source for your date control. Of course, if you are using this form to update the table you’ll need to get the updated data back into your original table (in which case it might be a better strategy to create a related (one-to-one) table that provides the dteNewDate for records where the date has changed, null otherwise).

          This, to me, is a bit cumbersome but if you need to use a form in a way it was not intended (as Hans has indicated), I guess you gotta pay the price.

          Maybe there’s an easier way… Quoting Ben Stein: Anyone? …Anyone?

          Good luck.

          • #676892

            Thanks to everyone for replying. I also agree with what Hans said. I was just trying to give the teacher what he wanted. I’ll just tell him he can’t always have what he wants. That should go over well.

    Viewing 0 reply threads
    Reply To: forms-repeating dates (97/SR2)

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

    Your information: