Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

How do you make a date / time stamp while starting a new entry?

Discussion in 'Information Technology' started by Shawn, Jul 28, 2006.

  1. Shawn

    Shawn
    Expand Collapse
    Guest

    My database is used to log and journal technical calls for our product. It
    is important for me to keep a date and time for everytime I receive and end a
    call. Same thing with any journals that I have attached to that call record.
    How do I Make a Date / Time stamp appear when I start a new record (when
    clicking the 'New Record' button) and when I end the record (when clicking
    the 'Save Record' button)? The date / time can not change once it's been
    "stamped".
    Thank you.
     
  2. Loading...


  3. Douglas J. Steele

    Douglas J. Steele
    Expand Collapse
    Guest

    In the table, set the default for the field to Now()

    In the form's BeforeInsert (or BeforeUpdate if you want it to change each
    time the record's reviewed), put code to set the field to Now().

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no private e-mails, please)


    "Shawn" <Shawn@discussions.microsoft.com> wrote in message
    news:2E0222DB-1E4D-40D9-B5A2-19E66C82E78C@microsoft.com...
    > My database is used to log and journal technical calls for our product.
    > It
    > is important for me to keep a date and time for everytime I receive and
    > end a
    > call. Same thing with any journals that I have attached to that call
    > record.
    > How do I Make a Date / Time stamp appear when I start a new record (when
    > clicking the 'New Record' button) and when I end the record (when clicking
    > the 'Save Record' button)? The date / time can not change once it's been
    > "stamped".
    > Thank you.
     
  4. Ofer Cohen

    Ofer Cohen
    Expand Collapse
    Guest

    Open the table in design view, in the field properties set the Default value
    of the field to:

    Now()
    will return the current date and time

    Date()
    will return the current date

    Time()
    will return the current time

    --
    Good Luck
    BS"D


    "Shawn" wrote:

    > My database is used to log and journal technical calls for our product. It
    > is important for me to keep a date and time for everytime I receive and end a
    > call. Same thing with any journals that I have attached to that call record.
    > How do I Make a Date / Time stamp appear when I start a new record (when
    > clicking the 'New Record' button) and when I end the record (when clicking
    > the 'Save Record' button)? The date / time can not change once it's been
    > "stamped".
    > Thank you.
     
  5. Rick B

    Rick B
    Expand Collapse
    Guest

    Just add a field to your table for the start and end date/time. Add these
    to your form. Personally, I would not make them visible.

    Set the default value on the start time to =Now()
    Or, you could use the "before insert" event and set the field "when the
    first character is typed in a new record". This would be best if you leave
    the form sitting open and at a blank record between calls.


    Use code to set the end time to Now() put the code in the "before
    update" event.

    I have not tested those events, so make sure it does what you expect.

    --
    Rick B



    "Shawn" <Shawn@discussions.microsoft.com> wrote in message
    news:2E0222DB-1E4D-40D9-B5A2-19E66C82E78C@microsoft.com...
    > My database is used to log and journal technical calls for our product.
    > It
    > is important for me to keep a date and time for everytime I receive and
    > end a
    > call. Same thing with any journals that I have attached to that call
    > record.
    > How do I Make a Date / Time stamp appear when I start a new record (when
    > clicking the 'New Record' button) and when I end the record (when clicking
    > the 'Save Record' button)? The date / time can not change once it's been
    > "stamped".
    > Thank you.
     
  6. Shawn

    Shawn
    Expand Collapse
    Guest

    Re: How do you make a date / time stamp while starting a new entry

    If I'm not mistaken, that will change the date / time everytime I open, or
    view the form, correct? It's important that the date / time is stamped in so
    that it won't change everytime I go into that form for review.

    Also, this is only for the start of the form, this won't help me when I save
    the form. How could I enter this 'stamp' when I save the form? Remember, I
    must keep it so that it won't change when I go back and review it.

    "Douglas J. Steele" wrote:

    > In the table, set the default for the field to Now()
    >
    > In the form's BeforeInsert (or BeforeUpdate if you want it to change each
    > time the record's reviewed), put code to set the field to Now().
    >
    > --
    > Doug Steele, Microsoft Access MVP
    > http://I.Am/DougSteele
    > (no private e-mails, please)
    >
    >
    > "Shawn" <Shawn@discussions.microsoft.com> wrote in message
    > news:2E0222DB-1E4D-40D9-B5A2-19E66C82E78C@microsoft.com...
    > > My database is used to log and journal technical calls for our product.
    > > It
    > > is important for me to keep a date and time for everytime I receive and
    > > end a
    > > call. Same thing with any journals that I have attached to that call
    > > record.
    > > How do I Make a Date / Time stamp appear when I start a new record (when
    > > clicking the 'New Record' button) and when I end the record (when clicking
    > > the 'Save Record' button)? The date / time can not change once it's been
    > > "stamped".
    > > Thank you.

    >
    >
    >
     
  7. Rick Brandt

    Rick Brandt
    Expand Collapse
    Guest

    Re: How do you make a date / time stamp while starting a new entry

    Shawn wrote:
    > If I'm not mistaken, that will change the date / time everytime I
    > open, or view the form, correct?


    No. It will be set when a new record is created and then won't change again
    (unless you change it).


    --
    Rick Brandt, Microsoft Access MVP
    Email (as appropriate) to...
    RBrandt at Hunter dot com
     
  8. Shawn

    Shawn
    Expand Collapse
    Guest

    Re: How do you make a date / time stamp while starting a new entry

    We're half way there. I have the Beginning date/time working. I tried
    puting the "Now() in the "before update" event but it didn't work. I did
    this through the form and in the property for the Ending Date, hoping that
    the date/time would show up after saving or exiting the newly created event.
    Was I supposed to do this somewhere within the Table? I couldn't find the
    "before update" option within the table. Am I doing something wrong?

    "Rick B" wrote:

    > Just add a field to your table for the start and end date/time. Add these
    > to your form. Personally, I would not make them visible.
    >
    > Set the default value on the start time to =Now()
    > Or, you could use the "before insert" event and set the field "when the
    > first character is typed in a new record". This would be best if you leave
    > the form sitting open and at a blank record between calls.
    >
    >
    > Use code to set the end time to Now() put the code in the "before
    > update" event.
    >
    > I have not tested those events, so make sure it does what you expect.
    >
    > --
    > Rick B
    >
    >
    >
    > "Shawn" <Shawn@discussions.microsoft.com> wrote in message
    > news:2E0222DB-1E4D-40D9-B5A2-19E66C82E78C@microsoft.com...
    > > My database is used to log and journal technical calls for our product.
    > > It
    > > is important for me to keep a date and time for everytime I receive and
    > > end a
    > > call. Same thing with any journals that I have attached to that call
    > > record.
    > > How do I Make a Date / Time stamp appear when I start a new record (when
    > > clicking the 'New Record' button) and when I end the record (when clicking
    > > the 'Save Record' button)? The date / time can not change once it's been
    > > "stamped".
    > > Thank you.

    >
    >
    >
     
  9. Rick B

    Rick B
    Expand Collapse
    Guest

    Re: How do you make a date / time stamp while starting a new entry

    You have to write code that runs on the before update event.

    Select "event procedure". Then click the triple dots to go into the vba
    script.

    Make your code something like...

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    SomeControlName = Now()
    End Sub




    replace "SomeControlName" with the name of your control.



    --
    Rick B



    "Shawn" <Shawn@discussions.microsoft.com> wrote in message
    news:69311261-0E1E-47E5-9B2C-CE6BE45D9F74@microsoft.com...
    > We're half way there. I have the Beginning date/time working. I tried
    > puting the "Now() in the "before update" event but it didn't work. I did
    > this through the form and in the property for the Ending Date, hoping that
    > the date/time would show up after saving or exiting the newly created
    > event.
    > Was I supposed to do this somewhere within the Table? I couldn't find the
    > "before update" option within the table. Am I doing something wrong?
    >
    > "Rick B" wrote:
    >
    >> Just add a field to your table for the start and end date/time. Add
    >> these
    >> to your form. Personally, I would not make them visible.
    >>
    >> Set the default value on the start time to =Now()
    >> Or, you could use the "before insert" event and set the field "when the
    >> first character is typed in a new record". This would be best if you
    >> leave
    >> the form sitting open and at a blank record between calls.
    >>
    >>
    >> Use code to set the end time to Now() put the code in the "before
    >> update" event.
    >>
    >> I have not tested those events, so make sure it does what you expect.
    >>
    >> --
    >> Rick B
    >>
    >>
    >>
    >> "Shawn" <Shawn@discussions.microsoft.com> wrote in message
    >> news:2E0222DB-1E4D-40D9-B5A2-19E66C82E78C@microsoft.com...
    >> > My database is used to log and journal technical calls for our product.
    >> > It
    >> > is important for me to keep a date and time for everytime I receive and
    >> > end a
    >> > call. Same thing with any journals that I have attached to that call
    >> > record.
    >> > How do I Make a Date / Time stamp appear when I start a new record
    >> > (when
    >> > clicking the 'New Record' button) and when I end the record (when
    >> > clicking
    >> > the 'Save Record' button)? The date / time can not change once it's
    >> > been
    >> > "stamped".
    >> > Thank you.

    >>
    >>
    >>
     
  10. Douglas J. Steele

    Douglas J. Steele
    Expand Collapse
    Guest

    Re: How do you make a date / time stamp while starting a new entry

    Or, perhaps better,

    Me.SomeControlName = Now()

    just to be sure.

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no private e-mails, please)


    "Rick B" <Anonymous> wrote in message
    news:%23wCAbzHnGHA.4604@TK2MSFTNGP02.phx.gbl...
    > You have to write code that runs on the before update event.
    >
    > Select "event procedure". Then click the triple dots to go into the vba
    > script.
    >
    > Make your code something like...
    >
    > Private Sub Form_BeforeUpdate(Cancel As Integer)
    > SomeControlName = Now()
    > End Sub
    >
    >
    >
    >
    > replace "SomeControlName" with the name of your control.
    >
    >
    >
    > --
    > Rick B
    >
    >
    >
    > "Shawn" <Shawn@discussions.microsoft.com> wrote in message
    > news:69311261-0E1E-47E5-9B2C-CE6BE45D9F74@microsoft.com...
    >> We're half way there. I have the Beginning date/time working. I tried
    >> puting the "Now() in the "before update" event but it didn't work. I did
    >> this through the form and in the property for the Ending Date, hoping
    >> that
    >> the date/time would show up after saving or exiting the newly created
    >> event.
    >> Was I supposed to do this somewhere within the Table? I couldn't find
    >> the
    >> "before update" option within the table. Am I doing something wrong?
    >>
    >> "Rick B" wrote:
    >>
    >>> Just add a field to your table for the start and end date/time. Add
    >>> these
    >>> to your form. Personally, I would not make them visible.
    >>>
    >>> Set the default value on the start time to =Now()
    >>> Or, you could use the "before insert" event and set the field "when the
    >>> first character is typed in a new record". This would be best if you
    >>> leave
    >>> the form sitting open and at a blank record between calls.
    >>>
    >>>
    >>> Use code to set the end time to Now() put the code in the "before
    >>> update" event.
    >>>
    >>> I have not tested those events, so make sure it does what you expect.
    >>>
    >>> --
    >>> Rick B
    >>>
    >>>
    >>>
    >>> "Shawn" <Shawn@discussions.microsoft.com> wrote in message
    >>> news:2E0222DB-1E4D-40D9-B5A2-19E66C82E78C@microsoft.com...
    >>> > My database is used to log and journal technical calls for our
    >>> > product.
    >>> > It
    >>> > is important for me to keep a date and time for everytime I receive
    >>> > and
    >>> > end a
    >>> > call. Same thing with any journals that I have attached to that call
    >>> > record.
    >>> > How do I Make a Date / Time stamp appear when I start a new record
    >>> > (when
    >>> > clicking the 'New Record' button) and when I end the record (when
    >>> > clicking
    >>> > the 'Save Record' button)? The date / time can not change once it's
    >>> > been
    >>> > "stamped".
    >>> > Thank you.
    >>>
    >>>
    >>>

    >
    >
     
  11. Shawn

    Shawn
    Expand Collapse
    Guest

    Re: How do you make a date / time stamp while starting a new entry

    What I did (which hasn't worked):
    1) Opened the form in Design Mode.
    2) Went into the properties of my Textbox (End Time).
    3) Wnt into the Before Update box and click the "..."; which is beside the
    [Event Procedure].
    4) I simply copied your suggestion and pasted it in the code.
    5) I suggested putting the "Me." suggested, but it didn't help. I
    presented a drop-down of options, but I didn't do anything w/ it.

    I'm sure that I have to create a Control & a name for the control. How?

    "Rick B" wrote:

    > You have to write code that runs on the before update event.
    >
    > Select "event procedure". Then click the triple dots to go into the vba
    > script.
    >
    > Make your code something like...
    >
    > Private Sub Form_BeforeUpdate(Cancel As Integer)
    > SomeControlName = Now()
    > End Sub
    >
    >
    >
    >
    > replace "SomeControlName" with the name of your control.
    >
    >
    >
    > --
    > Rick B
    >
    >
    >
    > "Shawn" <Shawn@discussions.microsoft.com> wrote in message
    > news:69311261-0E1E-47E5-9B2C-CE6BE45D9F74@microsoft.com...
    > > We're half way there. I have the Beginning date/time working. I tried
    > > puting the "Now() in the "before update" event but it didn't work. I did
    > > this through the form and in the property for the Ending Date, hoping that
    > > the date/time would show up after saving or exiting the newly created
    > > event.
    > > Was I supposed to do this somewhere within the Table? I couldn't find the
    > > "before update" option within the table. Am I doing something wrong?
    > >
    > > "Rick B" wrote:
    > >
    > >> Just add a field to your table for the start and end date/time. Add
    > >> these
    > >> to your form. Personally, I would not make them visible.
    > >>
    > >> Set the default value on the start time to =Now()
    > >> Or, you could use the "before insert" event and set the field "when the
    > >> first character is typed in a new record". This would be best if you
    > >> leave
    > >> the form sitting open and at a blank record between calls.
    > >>
    > >>
    > >> Use code to set the end time to Now() put the code in the "before
    > >> update" event.
    > >>
    > >> I have not tested those events, so make sure it does what you expect.
    > >>
    > >> --
    > >> Rick B
    > >>
    > >>
    > >>
    > >> "Shawn" <Shawn@discussions.microsoft.com> wrote in message
    > >> news:2E0222DB-1E4D-40D9-B5A2-19E66C82E78C@microsoft.com...
    > >> > My database is used to log and journal technical calls for our product.
    > >> > It
    > >> > is important for me to keep a date and time for everytime I receive and
    > >> > end a
    > >> > call. Same thing with any journals that I have attached to that call
    > >> > record.
    > >> > How do I Make a Date / Time stamp appear when I start a new record
    > >> > (when
    > >> > clicking the 'New Record' button) and when I end the record (when
    > >> > clicking
    > >> > the 'Save Record' button)? The date / time can not change once it's
    > >> > been
    > >> > "stamped".
    > >> > Thank you.
    > >>
    > >>
    > >>

    >
    >
    >
     

Share This Page