Results 1 to 7 of 7
  1. #1
    Milgrl3 is offline Novice
    Windows 7 32bit Access 2013 32bit
    Join Date
    Mar 2016
    Posts
    5

    Exclamation Setting upcoming Friday as default value

    Hello All,



    I am a newbie to this site and need some help for work. I am creating a database in Access 2013 and one of my fields is "Week Of." I want this field to auto populate the upcoming Friday and I am in need of help! I have used different expressions to do this but nothing is working for me.

  2. #2
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    This calculation should do that:
    Code:
    IIf(Weekday(Date(),6)=1,Date(),Date()+8-Weekday(Date(),6))

  3. #3
    Milgrl3 is offline Novice
    Windows 7 32bit Access 2013 32bit
    Join Date
    Mar 2016
    Posts
    5
    I get an error message that "the expression you entered has a function name that Microsoft Access can't find." This is the error message I keep getting every time.

  4. #4
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Where exactly are you entering this calculation?
    Are you doing it in a query or in a text box on a Form or Report?

  5. #5
    Milgrl3 is offline Novice
    Windows 7 32bit Access 2013 32bit
    Join Date
    Mar 2016
    Posts
    5
    It is a default value in a field on a table:

    Click image for larger version. 

Name:	help.png 
Views:	8 
Size:	17.2 KB 
ID:	24039

    Needs to be a table because I am going to be using this in a web app as well.

  6. #6
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You cannot use formulas in field Default Values.

    If you control all data entry through forms, you can include VBA code that populates this field with a similar VBA calculation upon data entry.
    Or, if you are importing data, you can use an Update Query to update this field with this calculation afterwards.

  7. #7
    Milgrl3 is offline Novice
    Windows 7 32bit Access 2013 32bit
    Join Date
    Mar 2016
    Posts
    5
    Ended up giving up on the Access Web App. Going to try another avenue to create this database and add it to our shared drive. What would be the code to add to a form? That I can definitely try!

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

Similar Threads

  1. Setting default with an IIF Function
    By cptdave1996 in forum Access
    Replies: 14
    Last Post: 12-14-2015, 01:57 PM
  2. Setting default
    By Thompyt in forum Programming
    Replies: 10
    Last Post: 11-10-2014, 11:49 AM
  3. Calculate last 4 weeks (Friday to Friday)
    By Astron2012 in forum Queries
    Replies: 2
    Last Post: 11-29-2013, 04:08 PM
  4. Setting default value to zero in form box?
    By dekhelia in forum Forms
    Replies: 6
    Last Post: 10-17-2013, 08:53 AM
  5. Field to display last Friday's date by default
    By lsmcal1984 in forum Forms
    Replies: 11
    Last Post: 10-07-2013, 12:05 PM

Tags for this Thread

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