Results 1 to 4 of 4
  1. #1
    newegyptian is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Mar 2019
    Posts
    46

    name of day and if function

    I want to creat text box


    If date = saturday , vacancy
    If date = sunday , work
    If date = monday , surgery

    And so on

    How i can make that

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,918
    Write a custom VBA function.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Your info on exactly what you're trying to do is sparse...but the general approach would be to use the WeekDay() function. If you're basing this on an entered date...the syntax would be

    Code:
    If WeekDay(Me.DateEntered) = 1 Then Me.YourTextboxName = "Work" 'Sunday   
    If WeekDay(Me.DateEntered) = 2 Then Me.YourTextboxName = "Surgery" 'Monday
    ...........
    ............
    .............
    If WeekDay(Me.DateEntered) = 7 Then Me.YourTextboxName = "Vacancy" 'Saturday


    If basing it on the Current Date

    Code:
    If WeekDay(Date()) = 1 Then Me.YourTextboxName = "Work"
    And so forth.

    You could also probably use the Select Case construct instead of If...Then.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    newegyptian is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Mar 2019
    Posts
    46
    Quote Originally Posted by Missinglinq View Post
    Your info on exactly what you're trying to do is sparse...but the general approach would be to use the WeekDay() function. If you're basing this on an entered date...the syntax would be

    Code:
    If WeekDay(Me.DateEntered) = 1 Then Me.YourTextboxName = "Work" 'Sunday   
    If WeekDay(Me.DateEntered) = 2 Then Me.YourTextboxName = "Surgery" 'Monday
    ...........
    ............
    .............
    If WeekDay(Me.DateEntered) = 7 Then Me.YourTextboxName = "Vacancy" 'Saturday


    If basing it on the Current Date

    Code:
    If WeekDay(Date()) = 1 Then Me.YourTextboxName = "Work"
    And so forth.

    You could also probably use the Select Case construct instead of If...Then.

    Linq ;0)>


    THANKS ALOT
    REALLY YOU HELPED ME
    MANY THANKS
    SOLVED

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

Similar Threads

  1. Replies: 15
    Last Post: 10-17-2018, 09:26 PM
  2. Replies: 15
    Last Post: 05-31-2017, 02:10 PM
  3. Replies: 2
    Last Post: 02-26-2017, 11:31 AM
  4. Replies: 3
    Last Post: 03-04-2016, 10:36 AM
  5. Replies: 8
    Last Post: 11-04-2014, 10:44 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