• forms repeating dates Another approach (97/SR2)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » forms repeating dates Another approach (97/SR2)

    • This topic has 13 replies, 8 voices, and was last updated 22 years ago.
    Author
    Topic
    #387594

    Let me try another approach to my earlier post:
    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 …

    I can’t eliminate the dates in each file. Is there a way to have a line appear on the form after that last file for each given date.
    Like this:
    3/5/03 file
    3/5/03 file
    ______________

    3/6/03 file
    3/6/03 file

    At least then the page would be easier to read. Thanks for ideas.

    Viewing 2 reply threads
    Author
    Replies
    • #676920

      Although you haven’t said so explicitly, it appears that your form is set up for “continuous forms” as your default view. This being the case, you’re always going to have problems modifying the appearance of your form based on the values of the underlying data (e.g., not displaying a date or adding a line separator if the date has changed from the previous record). This is because the appearance of a given control (e.g., the date control) can appear only one way even though it can appears many times (for the Continuous Forms view). For example, if the current record’s data dictates that the control should be made invisible, then it’s going to appear invisible for all of the records shown in the Continuous Forms view, regardless of it value for other records. Hence, you’re more or less stuck unless you switch to Single Form view, but then you don’t get the list you’re looking for.

      The only workaround for this that I’ve figured out is to massage your data (as I described in post 254419) to include a “to be displayed as” field.

      • #677082

        Building on Toms approach you could use a custom function in the query behind the form to create a new column which just shows the dates once and display this column in the Form. The code for the module would be something like,

        Function CheckDate(dDate As Date) As Variant
        Static lastDate As Date
        If dDate lastDate Then CheckDate = dDate
        lastDate = dDate
        End Function

        In the Query you would use “ShowDate: checkdate([Mydate])” in a new column to create the new field for your form.

        However with this approach if anyone sorts the data in the form you are going to get some screwy results!!

        HTH

        Peter

        • #677126

          Just a minor quibble. The code is for a routine or function, not a module. A module is a container that holds code, not the routines themselves. I know you are aware of the differences, but I wanted to make it clear for those who are new to VBA in Access.

    • #676952

      Why not try creating a report with the same recordset of the form and then use the sorting and grouping feature on the report grouped on Date?

    • #676954

      One other approach. If your data is set in two tables as a one to many relationship then create a mainform with a subform. Link the parent and child on the linked fields between the form. Set the main form with the date data. The subform with the file data. Then when you scroll through the date data (one record) the subform will show all associated files.

      HTH

      • #676956

        Paul wants the results on a form Gary… A continuous form… I suggested the Main form (single)/ Subform (continuous) thing earlier today…. GMTA!
        I ran out of ideas… smile

        • #676998

          GMTA??

          • #677002

            Great Minds Think Alike

            or take your pick:

            Georgia Motor Trucking Association
            Greenfield Montague Transportation Area
            Guam Mass Transit Authority
            Genetically Modified Total Annihilation
            Greater Madison Tennis Association

          • #677004

            Geezzzz… Hans knows it ALL! thumbup

    Viewing 2 reply threads
    Reply To: forms repeating dates Another approach (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: