Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2006
    Posts
    110

    Unanswered: how to determine if date is a Sunday?

    I am unsure how to do this, my thought would be as shown below, but Im missing something. Any help would be appreciated.


    If Me.death_cert_rec.dayofweek = dayofweek.Sunday Then
    Me.Days_Late_DC1.ControlSource = DateDiff("d", [Decedent_DOD], [death_cert_received]) - 7 - DateDiff("ww", [Decedent_DOD], [death_cert_received]) - 2
    end if

  2. #2
    Join Date
    Aug 2009
    Location
    Up Nort' Wi
    Posts
    140
    Try "If WeekDay(YourDateField) = 1 Then"

    Sam, hth
    Good, fast, cheap...Pick 2.

  3. #3
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Have a look at the native VBA DatePart function:
    Code:
    DatePart(interval, date[,firstdayofweek, firstweekofyear]])
    Have a nice day!

  4. #4
    Join Date
    Oct 2006
    Posts
    110
    I am trying
    If WeekDay(death_cert_received) = 1 Then
    Me.Days_Late_DC1.ControlSource = DateDiff("d", [Decedent_DOD], [death_cert_received]) - 7 - DateDiff("ww", [Decedent_DOD], [death_cert_received]) - 2
    end if


    However in VBA it is adding spacing to my datediff line and not reading it correctly so I get Name? instead.

    Is there a way to have it not space?

    Thanks

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    use the intrinsic VB constants such as VB_Sunday
    makes you code easier to read
    I'd rather be riding on the Tiger 800 or the Norton

  6. #6
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Easy.
    Code:
    If hangover = vbExcruciating Then
    isSunday = True
    End If
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •