1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

MS Access - autofill date field

Discussion in 'Business Applications' started by meeuwenjl, Mar 8, 2006.

Thread Status:
Not open for further replies.
Advertisement
  1. meeuwenjl

    meeuwenjl Thread Starter

    Joined:
    Mar 8, 2006
    Messages:
    2
    Hello everyone,

    I'm working on an order management database and I'm stuck on one item.

    I have a form that users can fill in with purchase order data. One section of the form relates to contract review completion.

    I would like to have a checkbox that the user can check when contract review is complete, but I'd also like for a completion date field to be auto-filled when the checkbox is checked.

    I've tried a couple of things, both unsuccessful.

    Any ideas?

    Thanks.
     
  2. Sponsor

  3. jim4004

    jim4004

    Joined:
    Feb 23, 2006
    Messages:
    92
    Use the after update event to insert a value into that form field reference using VBA.

    You'll need to format the control for the field name properly. Here's a sample of one line of code you could put into the event for the checkbox:

    Me.ChangeDt = Now()

    Where ChangeDt is a database field on the form that contains the date.
     
  4. jim4004

    jim4004

    Joined:
    Feb 23, 2006
    Messages:
    92
    Note that the above line will perform whether the check box is turned on or off. You may need to add an If statement to check if the value is turning on or off:

    If MyCheckBox Then 'Same as saying If MyCheckBox = True
    Me.ChangeDt = Now()
    End If
     
  5. meeuwenjl

    meeuwenjl Thread Starter

    Joined:
    Mar 8, 2006
    Messages:
    2
    thanks jim. i'm not well versed at VBA, but a few minutes of debugging and it was doing exactly what i wanted.
     
  6. jim4004

    jim4004

    Joined:
    Feb 23, 2006
    Messages:
    92
    Glad to hear you got it worked out.
     
  7. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/448415