Results 1 to 8 of 8

Thread: What day is it?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    UK
    Posts
    66

    Lightbulb

    Hi folks!

    I need to display a particular text box depending on the day.

    ie

    If it's Mon, Tues, Wed or Thurs - display txt1
    If it's Friday - display txt2

    How could I go about doing this?

    Cheers

    Simon

  2. #2
    Lively Member
    Join Date
    Aug 2000
    Location
    México, D.F.
    Posts
    64

    Talking

    Try this:

    Sub form_load()
    Dim a As String
    a = UCase(Format(Day(Now), "dddd"))
    Select Case a
    Case "Monday"
    txt1.Visible = True
    End Select
    End sub

  3. #3
    Guest
    Try the following:
    Code:
    Select Case Format(Date, "dddd")
        Case "Sunday"
            'It's Sunday
        Case "Monday"
            'It's Monday
        Case "Tuesday"
            'It's Tuesday
        Case "Wednesday"
            'It's Wednesday
        Case "Thursday"
            'It's Thursday
        Case "Firday"
            'It's Firday
        Case "Saturday"
            'It's Saturday
    End Select

  4. #4
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    Code:
    Select Case Weekday(Now)
      'mon - thu
      Case 2 To 5
        Text1.Visible = True
      'friday
      Case 6
        Text2.Visible = True
      Case Else
        'else
    End Select
    Oh well, as usual beatean to it
    look like i am the one guilty of posting after the answer.
    Iain, thats with an i by the way!

  5. #5
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    Use the Weekday function:
    Code:
    Dim intWeekday  As Integer
    Dim dtmTestDate As Date
    
    intWeekday = Weekday(dtmTestDate)
    Select Case intWeekday
        Case Is vbMonday To vbThursday
            Text1.Text = "Monday thru Thursday message"
        Case vbFriday
            Text1.Text = "Friday message"
        Case Else
            ' whatever
    End Select
    "It's cold gin time again ..."

    Check out my website here.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    UK
    Posts
    66
    Waheey!

    Thanks guys for probably the speediest replies on record

    Cheers

    Simon

  7. #7
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    I can't get into your other post for some reason so I'll give you my answer to your question on datediff here:

    'my guess (I'm not sure where it starts counting)
    'thurs or Mon...the stuff is hard reading..


    'assuming there are 5 working days in each week

    Dim nDateDiff As Variant
    nDateDiff = DateDiff("w", Date, "20/10/2000", vbMonday) * 5
    x = nDateDiff
    MsgBox x
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    UK
    Posts
    66
    Thanks! That's great!

    Cheers

    Simon

Posting Permissions

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



Click Here to Expand Forum to Full Width