Results 1 to 5 of 5
  1. #1
    Auto is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2013
    Posts
    60

    Update Field based on form value

    hi all,

    i am having a table with few columns, like CustomerID, SalesTotal, DateOrder, DateDue
    then i am having a form for that table, and user picks a date now, i want that DateDue should be 30 Days after DateOrder, somehow i can get that done.

    i tried making an after update on DateOrder and i placed this expression DateDue=DateOrder+30 and it dont show up anything
    can anyone help please?

  2. #2
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    Are DateOrder and DateDue defined as Date/Time type?

    If not, need to convert the date string using "CDate" or some date function to convert to date/time type to do add.

    Alternatively, function "DateAdd" will work as well.

  3. #3
    Auto is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2013
    Posts
    60
    thanks ifpm062010 for yr reply
    answer on DateTime type is yes, they are both Date type
    in regards to DateAdd, i tried that one too, but i cant get it work

  4. #4
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    I created a simple table like you suggested and create a form using the form wizard based on that table.

    Then I edited the "AfterUpdate" event on "DateOrder" textbox.
    Private Sub DateOrder_AfterUpdate()
    DateDue = DateOrder + 30
    End Sub

    Then I tested the form. It worked like it should.

    The DateAdd will look like.
    Private Sub DateOrder_AfterUpdate()
    DateDue = DateAdd("d", DateOrder, 30)
    End Sub

    If you still have problem, can you post your code and/or your db.

  5. #5
    Auto is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2013
    Posts
    60
    brilliant, thanks
    that works, i placed it in default value, should be in AfterUpdate
    like this
    Then I edited the "AfterUpdate" event on "DateOrder" textbox.

    Private Sub DateOrder_AfterUpdate()
    DateDue = DateOrder + 30
    End Sub

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

Similar Threads

  1. Replies: 4
    Last Post: 08-25-2013, 07:43 AM
  2. Replies: 5
    Last Post: 11-01-2012, 09:26 AM
  3. Replies: 5
    Last Post: 04-24-2012, 06:42 PM
  4. Replies: 9
    Last Post: 04-13-2012, 10:10 AM
  5. Replies: 4
    Last Post: 04-18-2011, 07:18 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