Results 1 to 7 of 7
  1. #1
    nktrygg is offline Novice
    Windows XP Access 2000
    Join Date
    Jan 2010
    Posts
    3

    date calculation then autofill?

    Hello



    Just wondering if there's a way to do this:

    field 1 - manually fill in a date

    feild 2 - refers to field one, subtracts a year and then automatically fills in that date.


    I have a databased that manages 400 records that are leases/legal agreements - and field 1 is the expiry date of the agreement and feild 2 is the date we have to give notice to the leasee that the contract is going to expire

    I know it might seem pedantic to have the field 2, but I have to run a BF report for an 18 month period to let other people know that they have to give notifications ahead of time.


    So, the report I give them will have

    lease # / client / expiry date / expiry notice

  2. #2
    llkhoutx is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Location
    Houston, Texas USA
    Posts
    373
    Do not use blanks or special characters in field name. It will cause a world of grief when building SQL queries.

    field1 populated on a form

    me.field2=dateadd("yyyy",-1,cdate(field1))

  3. #3
    jbarrum is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Apr 2009
    Location
    Houston, Tx
    Posts
    164
    Create a date field in your table and in the "default Value" parameter put the following:

    Date()

    This will default the date in the record to the system date when the record is created.

    Next you can creat a query from that table and add a column with the following expression:

    NewDate: [DateFieldName]-365

    This will look at the date field and subtract 365 days and return a new date one year earlier.

  4. #4
    llkhoutx is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Location
    Houston, Texas USA
    Posts
    373
    Subtracting 365 is just not right. Decrement the year as I posted.

  5. #5
    jbarrum is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Apr 2009
    Location
    Houston, Tx
    Posts
    164
    I suppose that leap year would pose a problem with my method?

  6. #6
    nktrygg is offline Novice
    Windows XP Access 2000
    Join Date
    Jan 2010
    Posts
    3
    Quote Originally Posted by jbarrum View Post
    I suppose that leap year would pose a problem with my method?
    the date the record is created isn't relevant, usually the record is added to the database well in advance of the agreement being active - it's entered and tracked as a pending agreement

    it's the start date, event dates (ie: rent review) and end date of the agreement

    but, that will help for the other BF feild where I have to enter a date and then a 26 weeks notification date - which is a set number of days - so it does help me too

  7. #7
    nktrygg is offline Novice
    Windows XP Access 2000
    Join Date
    Jan 2010
    Posts
    3
    Quote Originally Posted by llkhoutx View Post
    Do not use blanks or special characters in field name. It will cause a world of grief when building SQL queries.

    field1 populated on a form

    me.field2=dateadd("yyyy",-1,cdate(field1))
    thank you!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Autofill form fields
    By roboticsguy1988 in forum Forms
    Replies: 1
    Last Post: 08-10-2009, 08:56 AM
  2. Date Calculation ?
    By techexpressinc in forum Queries
    Replies: 2
    Last Post: 06-24-2009, 09:02 PM
  3. Date Calculation -- HELP!
    By klaauser in forum Forms
    Replies: 0
    Last Post: 12-22-2008, 02:14 PM
  4. Question about creating a date calculation tool
    By bazillion in forum Programming
    Replies: 0
    Last Post: 01-25-2008, 12:08 PM
  5. Date Calculation within same fields
    By mslieder in forum Queries
    Replies: 3
    Last Post: 01-26-2006, 10:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums