Results 1 to 4 of 4
  1. #1
    mkfloque is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Posts
    24

    Add one day to prior record's date/ how??


    Hello All:

    I have a date field, whereby the first record will be 6/1/12. I need the next record to show 6/2/12 automatically, etc. I want the dates to auto-fill thru 12/31/12.

    How do i go about this?

    Thank you!

  2. #2
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    In the control source (I'll assume you are using a form) try the following in the default value,

    =dmax("[field_name]","[table_name]")+1

  3. #3
    mkfloque is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Posts
    24
    Hi R Badger,

    Actually, I'm not going to be using forms for this one; there's not much other data to enter. Once I have all my dates from 6/1/12 thru 12/31/12, i'll search out all Mondays & Thursdays to put extra info on those dates.

    So, basically, i'm needing this in a table (in a field called "Service Date" )...:
    6/1/2012
    6/2/2012
    6/3/2012
    6/4/2012
    6/5/2012
    6/6/2012
    6/7/2012
    6/8/2012

    (all the way thru 12/31/12).

    But, you solved a long-standing problem of mine! We have another Dbase with 4-digit ID's. With your solution, keyer won't need to go to prior record to see what # was there [wasn't set up as auto-number].

    Thanks much,
    M

  4. #4
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Assuming existing Table name "myTable" having a field "ServiceDate",
    just check out if running below gives some guidelines :

    Code:
    Function populateMyTable()
        
    Dim StartDate As Date
        Dim EndDate 
    As Date
        Dim dbs 
    As Database
        
        StartDate 
    #6/1/2012#
        
    EndDate #12/31/2012#
        
        
    Set dbs CurrentDb

        NextDate 
    StartDate

        
    For NextDate To EndDate
                
            strsqlInsert 
    "insert into MyTable (ServiceDate) VALUES (#" NextDate "#)"
            
    dbs.Execute (strsqlInsert)
           
            
    NextDate DateAdd("d"1NextDate)
        
    Next
        
        MsgBox 
    ("Successful")
    End Function 
    Thanks

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

Similar Threads

  1. Showing Graph of Prior Days Downtime
    By MFS in forum Forms
    Replies: 4
    Last Post: 03-28-2012, 05:11 AM
  2. Replies: 13
    Last Post: 09-27-2010, 03:10 PM
  3. New record take on all values of prior?
    By cps6568 in forum Access
    Replies: 3
    Last Post: 01-12-2010, 04:14 PM
  4. Date Parameter Help - prior 13 weeks
    By acw1980 in forum Access
    Replies: 1
    Last Post: 11-12-2009, 10:30 AM
  5. Replies: 1
    Last Post: 02-26-2009, 11:31 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