Results 1 to 7 of 7
  1. #1
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Top Property in Report (Access 2003)

    I have a db used for Training Course scheduling. Courses are held at Venues, and booked into rooms.
    I have a report that displays all the bookings for a room in any week.
    I attach a cut down version. The report uses code to place a text box for each room booking.

    Its left position is determined by the day of week.
    Its top position is determined by its start time.
    Its height is determined from the difference between Start time and Finish time.

    All this nearly works.
    (This is based an example I found at www.access.hookom.net/Samples.htm )

    In the attachment if you preview the report for all venues, it works OK until you scroll to page 4, where it throws the error- Invalid Top Value, for the first booking on that page.
    However if I filter the report by Venue so that only page 4 is shown, the top values are all OK.

    If I reverse the order of the report, the same problem occurs, but on a different page.

    It seems to get lost moving between pages, but only sometimes!
    Attached Files Attached Files
    Regards
    John



  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Top Property in Report (Access 2003)

    If the Height property of the CourseCode text box was left at a large value from the previous record, the new value of Top may make Top + Height too large for the section. You can get around this by resetting Height to a small value immediately before setting Top. It will be set to the correct value afterwards:

    Me.CourseCode.Height = 1
    Me.CourseCode.Top = lngtop

  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Top Property in Report (Access 2003)

    Thanks Hans

    That fixed it.
    Regards
    John



  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Top Property in Report (Access 2003)

    Dont ask me why this works, at least i think it does. Just changed the order of setting the top etc.

    <pre> Me.CourseCode.Left = 1000 + Me.offset * 1730

    lngHeight = DateDiff("n", Me.StartTime, Me.FinishTime) * lngOneMinute
    Me.CourseCode.Height = lngHeight

    lngtop = lngTopMargin + DateDiff("n", datSchedStart, Me.StartTime) * lngOneMinute
    ' Debug.Print lngtop
    Me.CourseCode.Top = lngtop
    </pre>


  5. #5
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Top Property in Report (Access 2003)

    Thanks Patt

    I think that Hans has found the underlying problem. The total of Height and Top can be temporarily an illegal value if you have one of them from the current record and one from the previous. So explicitly setting the Height to 1 should reliably stop the problem.

    Simply reversing the order in which the values are set might fix the problem with the data values in my little demo, but I think it still leaves open the underlying problem.
    Regards
    John



  6. #6
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Top Property in Report (Access 2003)

    That's true, i iniaially thought Access may have been acting up, but what Hans has said makes sense.

    If what he says is true, and i don't doubt him for a second, then to set all of them to 1 initially may not be a bad idea.

  7. #7
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Top Property in Report (Access 2003)

    Thanks Patt

    It does make sense to set both top and height back to 1, just in case.

    I have also been thinking I need to consider unexpected values for the Start and Finish time. I am told that courses can run anytime between 7AM and 6PM , but I don't want this to throw errors if someone timetables something to run until 9PM, or starts at 6AM.

    I think I will find a use for this in a few other jobs.

    I attach a modified version.
    Attached Files Attached Files
    Regards
    John



Posting Permissions

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