Automatically Increment Time?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bobby

    Automatically Increment Time?

    Please write suggestions on how to automatically increment time in a
    field (table or query).

    Example:

    Name | Time
    John Doe | 11:00 AM
    Jane Doe | 11:08 AM (8 minutes later)
    Jim Doe | 11:16 AM (8 minutes later)

    and so on...

    It would be quite tedious to manually add times for each person when
    this is something a computer could easily calculate.

    Thanks for your suggestions. :)
  • Jim Allensworth

    #2
    Re: Automatically Increment Time?

    On 7 Jan 2004 09:16:29 -0800, google@trumpetj azz.com (Bobby) wrote:
    [color=blue]
    >Please write suggestions on how to automatically increment time in a
    >field (table or query).
    >
    >Example:
    >
    >Name | Time
    >John Doe | 11:00 AM
    >Jane Doe | 11:08 AM (8 minutes later)
    >Jim Doe | 11:16 AM (8 minutes later)
    >
    >and so on...
    >
    >It would be quite tedious to manually add times for each person when
    >this is something a computer could easily calculate.
    >
    >Thanks for your suggestions. :)[/color]

    I'm not sure what you are doing, but take a look at DateAdd
    function...

    ?dateadd("n",8, now())
    1/7/2004 3:49:51 PM

    - Jim

    Comment

    • Pieter Linden

      #3
      Re: Automatically Increment Time?

      google@trumpetj azz.com (Bobby) wrote in message news:<1816988c. 0401070916.28da 27a3@posting.go ogle.com>...[color=blue]
      > Please write suggestions on how to automatically increment time in a
      > field (table or query).
      >
      > Example:
      >
      > Name | Time
      > John Doe | 11:00 AM
      > Jane Doe | 11:08 AM (8 minutes later)
      > Jim Doe | 11:16 AM (8 minutes later)
      >
      > and so on...
      >
      > It would be quite tedious to manually add times for each person when
      > this is something a computer could easily calculate.
      >
      > Thanks for your suggestions. :)[/color]

      I agree with the other response... could you explain EXACTLY what you
      want? Do you mean that you're intending to update a bunch of records
      or to create new ones? If this is something like an appointment
      system where "patients" have appointments every 8 minutes or whatever,
      then this is easy. You could just do this in code and increment your
      appointmentTime by 8 minutes each time. Then use a recordset to
      insert the records into a table.

      Comment

      • Anthony Cuttitta Jr.

        #4
        Re: Automatically Increment Time?

        google@trumpetj azz.com (Bobby) wrote in message news:<1816988c. 0401070916.28da 27a3@posting.go ogle.com>...[color=blue]
        > Please write suggestions on how to automatically increment time in a
        > field (table or query).
        >
        > Name | Time
        > John Doe | 11:00 AM
        > Jane Doe | 11:08 AM (8 minutes later)
        > Jim Doe | 11:16 AM (8 minutes later)[/color]

        Are these data entry times in a table? If so, in your date/time
        field, set the DefaultValue property in the table to Now(). Then, if
        you want to display it in a form as only time, set it to "Mediuim
        Time" and you'll get the display as above.

        If that's not what you're saying, then please explain further.

        Thanks,
        Anthony.

        Comment

        • Bobby

          #5
          Re: Automatically Increment Time?

          Thank you all!

          These are appointments that last the same amount of minutes for each
          person.

          Actually, the people have already been entered and sorted randomly
          into the table using the random increment feature. Now they need to be
          assigned 8 minute slots.

          I'll experiment with the DateAdd function.

          Thanks again!

          Comment

          • Bobby

            #6
            Re: Automatically Increment Time?

            "Jim Allensworth" <jimNOT@Notdata centricsolution s.com> wrote[color=blue]
            > I'm not sure what you are doing, but take a look at DateAdd
            > function...
            >
            > ?dateadd("n",8, now())
            > 1/7/2004 3:49:51 PM
            >
            > - Jim[/color]


            For each record, I need to add 8 minutes to the time in the previous
            field and place it in the current field.

            Can DateAdd() do this, or is there another way I can think of the same
            thing?

            Comment

            • Jim Allensworth

              #7
              Re: Automatically Increment Time?

              On 8 Jan 2004 10:29:34 -0800, google@trumpetj azz.com (Bobby) wrote:
              [color=blue]
              >"Jim Allensworth" <jimNOT@Notdata centricsolution s.com> wrote[color=green]
              >> I'm not sure what you are doing, but take a look at DateAdd
              >> function...
              >>
              >> ?dateadd("n",8, now())
              >> 1/7/2004 3:49:51 PM
              >>
              >> - Jim[/color]
              >
              >
              >For each record, I need to add 8 minutes to the time in the previous
              >field and place it in the current field.
              >
              >Can DateAdd() do this, or is there another way I can think of the same
              >thing?[/color]

              Bobby, a couple of thoughts:
              If the increment is always 8 minutes then you have no need to store
              it.
              If you are backfilling some data then yes you could use DateAdd to
              accomplish that.
              When you say "add 8 minutes to the time in the previous field" do you
              mean last field or previous record?

              At any rate DateAdd should do the trick.

              - Jim

              Comment

              • Rick Brandt

                #8
                Re: Automatically Increment Time?

                "Bobby" <google@trumpet jazz.com> wrote in message
                news:1816988c.0 401081029.70809 e91@posting.goo gle.com...[color=blue]
                > "Jim Allensworth" <jimNOT@Notdata centricsolution s.com> wrote[color=green]
                > > I'm not sure what you are doing, but take a look at DateAdd
                > > function...
                > >
                > > ?dateadd("n",8, now())
                > > 1/7/2004 3:49:51 PM
                > >
                > > - Jim[/color]
                >
                >
                > For each record, I need to add 8 minutes to the time in the previous
                > field and place it in the current field.
                >
                > Can DateAdd() do this, or is there another way I can think of the same
                > thing?[/color]

                If you are using DAO...

                Dim MyDb as Database
                Dim MyRS as Recordset
                Dim DateSeed as Date

                Set MyDB = CurrentDB
                Set MyRS = MyDB.OpenRecord set("YourTable" ,dbOpenDynaset)
                DateSeed = YourFirstDateTi meValue

                Do Until MyRS.EOF = True
                MyRS.Edit
                MyRS!YourDateFi eld = DateSeed
                MyRS.Update
                DateSeed = DateAdd("n",8,D ateSeed)
                MyRS/MoveNext
                Loop

                MyRS.Close
                Set MyRS = Nothing
                Set MyDB = Nothing

                (above should have appropriate Error Handling added)


                --
                I don't check the Email account attached
                to this message. Send instead to...
                RBrandt at Hunter dot com


                Comment

                Working...