Results 1 to 5 of 5
  1. #1
    jschlapi is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2011
    Posts
    8

    DateAdd Function


    I have a form (Called Entry Form) that includes a date which the user inputs. I would like to duplicate that record - which I've done & it works great - but now I would like to increment the date field by 1 day after the duplication is done.

    My date is in a text box (Called Text3957) and my code attached to a control button on the screen is: DataAdd("d",1,Text3957).......it does not work. The only part that works on the button is the Duplicate Record - I end up with the same date on both records.

    Any ideas why this is happening? Thank you for your time & advice.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What code do you have in the "DuplicateRecord" button?

  3. #3
    jschlapi is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2011
    Posts
    8
    This is what came with the button command:

    run command: SelectRecord
    run command: Copy
    run command: RecordsGoToNew
    run command: SelectRecord
    run command: paste
    run code: DateAdd("d",1,Text3957) -- THIS IS THE LINE I ADDED

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    We'll need to copy the previous date and save it somewhere (a variable maybe) before moving to the New record. I'm not versed in the RunCommands, only know code.

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    It may be something as simple as changing this line:
    run code: DateAdd("d",1,Text3957) -- THIS IS THE LINE I ADDED
    ...to...
    run code: Me.Text3957 = DateAdd("d",1,Text3957) '-- THIS IS THE LINE I ADDED

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

Similar Threads

  1. Replies: 4
    Last Post: 03-16-2013, 08:31 AM
  2. Open Report w DateAdd function
    By libraccess in forum Programming
    Replies: 3
    Last Post: 02-21-2013, 12:31 AM
  3. DateAdd function for workdays?
    By 10 Gauge in forum Programming
    Replies: 2
    Last Post: 04-06-2011, 09:20 AM
  4. DateAdd Function
    By Desstro in forum Programming
    Replies: 3
    Last Post: 04-03-2011, 01:45 PM
  5. Help Please - DateAdd Function
    By graviz in forum Queries
    Replies: 3
    Last Post: 03-02-2010, 02:34 PM

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