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
Printable View
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
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
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
Oh well, as usual beatean to it :(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
look like i am the one guilty of posting after the answer.
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
Waheey!
Thanks guys for probably the speediest replies on record :)
Cheers
Simon
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
Thanks! That's great!
Cheers
Simon