Results 1 to 2 of 2
  1. #1
    ExtremeNovice is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2017
    Posts
    24

    Tables: How to set a default value of a date field to an upcoming date of the 1st or the 15th

    I am building a payroll oriented database and learning Access as I go. I have a field titled 'DateWorked' and a field titled 'PayDate' in my table. Once I have entered the 'DateWorked' I would like my 'PayDate' field to default to the next upcoming pay date, which depending on when the data is entered, would be 15th of the current month or the 1st of the next month. Thanks!

  2. #2
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,807
    You are using a form, yes? Don't add or update information in tables, as a rule (not sure, but your post title could be saying this is the case). If this is in a form and the dates you need are not table record values, an unbound textbox can be used along with a complicated expression to compare the "Day part" of the DateWorked value's Day part against the current date, and if less than 15, use the 15th of the current month, else use the first of the next month. Personally, I keep a safe distance from complicated IIF expressions - they hurt my head. You could also use a custom function to return the correct date.

    If the dates are table values, a different approach would be used.
    Last edited by Micron; 02-27-2017 at 07:32 PM. Reason: clarification
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. default value for upcoming friday
    By Milgrl3 in forum SharePoint
    Replies: 2
    Last Post: 03-10-2016, 08:16 PM
  2. Setting upcoming Friday as default value
    By Milgrl3 in forum Access
    Replies: 6
    Last Post: 03-10-2016, 03:55 PM
  3. Replies: 4
    Last Post: 04-22-2015, 05:50 AM
  4. Replies: 5
    Last Post: 11-18-2012, 01:27 PM
  5. Query for upcoming expiration date
    By jones in forum Queries
    Replies: 2
    Last Post: 05-16-2012, 02: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