Message Box Question
Brian,
You only need to test for Mornimg or Afternoon, if it's neither of those it
has to be evening. Try this
If Time < 0.5 Then
Msg = "Morning"
ElseIf Time = 0.5 And Time < 0.75 Then
Msg = "Afternoon"
Else
Msg = "Evening"
End If
MsgBox "Good " & Msg
Mike
"Brian" wrote:
I have a User Form that has a Combo Box in it. I would like for it to greet
the user by name based on the time of day.
I have tried several variations of this code, but no luck as of yet.
Private Sub Greeting()
'Time Greeting
If Me.Engineer_2.Value = "Name" Then MsgBox
If Time < 0.5 Then Msg = "Morning" Else
If Time = 0.5 And Time < 0.75 Then Msg -"Afternoon" Else
If Time 0.75 Then Msg -"Evening"
MsgBox "Good" & Msg
End Sub
What am I doing wrong?
|