Results 1 to 7 of 7

Thread: Date Stamps

  1. #1
    Join Date
    May 2006
    Posts
    178

    Unanswered: Date Stamps

    Hey guys,

    I have a question about date stamping.
    I have a form which a user creates an Order, I have a date field that I have set to "=Date()"

    that once the Order is saved I dont want teh users to edit the date. HOw would I go about doing that, also Is it possible to keep a history of what has been changed on that record?

    Hope someone can help.

    Regards

    Aboo

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Your first request is simple: in Design View set the Locked Property for the textbox to Yes. Users can't edit it but Access will populate it from your code.

    As to your second question, the answer is Yes, you can keep an audit trail of changes, but be warned, this is not a project for the faint-hearted! Fortunately Allen Browne has an excellent tutorial on the subject:

    Allen Browne - Creating an Audit Log

    Good Luck!
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8
    On the Form you will have to create a Event
    on Current

    if in there

    have a If Statment

    If not NewRecord then
    me.datefield.enable = false
    end if
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    me.datefield.enable = false

    would need to be

    me.datefield.enabled = false

    and using the Enabled Property instead of the Locked will make the textbox appear grayed out; not very appealing.

    A good point though, about the NewRecord. I assumed that the OP only wanted the field populated by the current date thru code. IF he wants the user to be able to change the date when the record is new he would need to do something along these lines to lock it.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    Join Date
    May 2006
    Posts
    178
    Thankyou for all your reply guys.

  6. #6
    Join Date
    May 2006
    Posts
    178
    Guys,

    At the risk of sounding like an idiot, if i set the default value of the textbox to "=date()" would it not show the current date everytime the record is shown?


    Aboo

  7. #7
    Join Date
    Feb 2004
    Posts
    214

    ...

    It doesn't change the date, only make it the default value if none is there. So no, it will not overwrite and older date and make it today.
    You know, I'm sick of following my dreams, man. I'm just going to ask where they're going and hook up with 'em later

Posting Permissions

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