Results 1 to 3 of 3

Thread: Time dilemma

  1. #1
    Lounger
    Join Date
    Sep 2006
    Location
    Jhongli, Taiwan
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Time dilemma

    I am trying to design a subform for data entry that lists consecutive talks in a symposium as separate records. I set a default time for the series of talks to begin in the [StartTime] control (e.g; 8:40). Adding the time allotted for the talk [Duration] updates the [EndTime] control when tabbing out using the code below:

    Private Sub Duration_AfterUpdate()

    Dim MyDuration As Variant
    Dim MyTime As Variant

    MyTime = Me![StartTime].Value
    MyDuration = Me![Duration].Value + MyTime

    Me!EndTime = MyDuration

    End Sub

    However, when adding subsequent records, is it possible to set the value of the [StartTime] control to the [EndTime] value on the previous record?

    OR (even more useful when other records already exist) when updating the [Duration] control, is it possible to recalculate all subsequent [StartTime] and [EndTime] controls that exist in the current subform?

    Access 2007
    Last edited by bradym; 2014-11-09 at 06:32.

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts
    It is possible to do what you suggest, but it involves using some moderately complex VBA code to open a recordset that contains the records for talks in a specific symposium, using either DAO or ADO, and finding the maximum of the end time and populating the new start time with it. Presumably that would be triggered by a new record having it's subject entered. Unless you are comfortable with DAO or ADO, it's a major learning exercise. The same holds true for the change in the duration of a talk, and dealing with the boundary conditions.
    Wendell

  3. #3
    Lounger
    Join Date
    Sep 2006
    Location
    Jhongli, Taiwan
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yea, I do a lot of pasting and tweaking from pre-existing code or converted macros but I'm not really DAO or ADO literate.
    Thanks for the reply

Posting Permissions

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