Welcoming scrolling workds

F

Frank Situmorang

Hello,

Can any body help me how to make this 3 conditional welcoming words can work
true. This is VBA I learned from Database Dev UK.ID :
Private Sub Form_Timer()
Dim strMsg As String
Static I As Integer
I = I + 1
strMsg = "Selamat Pagi "
If I > Len(strMsg) Then I = 1
lblMorning.Caption = lblMorning.Caption & Mid(strMsg, I, 1)
End Sub

While this is the VBA to make a scrolling words:
Private Sub Form_Timer()
Dim strMsg As String
Static I As Integer
I = I + 1
strMsg = "Some message here "
If I > Len(strMsg) Then I = 1
LabelName.Caption = LabelName.Caption & Mid(strMsg, I, 1)
End Sub

MY QUESTION IS HOW CAN WE COMBINE THESE 2 VBA TO MAKE IT WORKS IN THE ABOVE
3 CONDITIONAL WORDS.

Thanks in advance,
 
F

Frank Situmorang

The problem Arvin, coz I have 3 conditional wecoming word, and I tried them
this way but does not work.

Private Sub Form_Timer()
'When the database is opened display welcome user message.
Dim strMsg As String
Static I As Integer
If Time() < 0.5 Then
[lblMorning].Visible = True
[lblAfternoon].Visible = False
[LblEvening].Visible = False
I = I + 1
strMsg = "Selamat Pagi"
If I > Len(strMsg) Then I = 1
lblMorning.Caption = lblMorning.Caption & Mid(strMsg, I, 1)
End If
ElseIf Time() > 0.5 And Time() < 0.75 Then
[lblMorning].Visible = False
[lblAfternoon].Visible = True
[LblEvening].Visible = False
I = I + 1
strMsg = "Selamat Siang"
If I > Len(strMsg) Then I = 1
lblAfternoon.Caption = lblAfternoon.Caption & Mid(strMsg, I, 1)
End If
ElseIf Time() > 0.75 Then
[lblMorning].Visible = False
[lblAfternoon].Visible = False
[LblEvening].Visible = True
I = I + 1
strMsg = "Selamat Malam"
If I > Len(strMsg) Then I = 1
LblEvening.Caption = LblEvening.Caption & Mid(strMsg, I, 1)
End If
End If
End Sub
 
A

Arvin Meyer [MVP]

Hi Frank,

You only need 1 label. Using my sample form, change my code to (tested) that
below. You may want to shorten strLen to 30 because there's fewer characters
in your string.

Private Sub Form_Timer()

Static strMsg As String
Static intLet As Integer
Static intLen As Integer
Dim strTmp As String
Dim strGreeting As String
Dim t As Double
Const strLen = 40

t = Time()

Select Case t
Case Is < 0.5
strGreeting = "Selamat Pagi"
Case 0.5 To 0.75
strGreeting = "Selamat Siang"
Case Is > 0.75
strGreeting = "Selamat Malam"
Case Else
MsgBox "Fix your computer's clock"
Exit Sub
End Select

If Len(strMsg) = 0 Then
strMsg = Space(strLen) & strGreeting
intLen = Len(strMsg)
End If

intLet = intLet + 1

If intLet > intLen Then
intLet = 1
End If

strTmp = Mid(strMsg, intLet, strLen)

Me!lblScroll.Caption = strTmp

If strTmp = Space(strLen) Then
intLet = 1 'Re-start scrolling
End If

End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
Frank Situmorang said:
The problem Arvin, coz I have 3 conditional wecoming word, and I tried
them
this way but does not work.

Private Sub Form_Timer()
'When the database is opened display welcome user message.
Dim strMsg As String
Static I As Integer
If Time() < 0.5 Then
[lblMorning].Visible = True
[lblAfternoon].Visible = False
[LblEvening].Visible = False
I = I + 1
strMsg = "Selamat Pagi"
If I > Len(strMsg) Then I = 1
lblMorning.Caption = lblMorning.Caption & Mid(strMsg, I, 1)
End If
ElseIf Time() > 0.5 And Time() < 0.75 Then
[lblMorning].Visible = False
[lblAfternoon].Visible = True
[LblEvening].Visible = False
I = I + 1
strMsg = "Selamat Siang"
If I > Len(strMsg) Then I = 1
lblAfternoon.Caption = lblAfternoon.Caption & Mid(strMsg, I, 1)
End If
ElseIf Time() > 0.75 Then
[lblMorning].Visible = False
[lblAfternoon].Visible = False
[LblEvening].Visible = True
I = I + 1
strMsg = "Selamat Malam"
If I > Len(strMsg) Then I = 1
LblEvening.Caption = LblEvening.Caption & Mid(strMsg, I, 1)
End If
End If
End Sub

--
H. Frank Situmorang


Arvin Meyer said:
You might want to try the working code in this sample database:

http://www.datastrat.com/Download/Scroll.zip
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
F

Frank Situmorang

Thank you very much Arvin, it works great for me. I am not so clear about
timing, so I can not modify it to adjust to Indonesian greetings, In
Indonesia is as follows:

1. From 00.00(night) am to 11 a.m we say Good Morning ( Selamat Pagi)
2. from 11 a.m to 3 p.m we say Good Noon ( Selamat Siang)
3. from 3.p,m to 6 p.m we say Good afternoon ( Selamat Sore)
4. From 6 p.m to 12 p.m we say Good Night ( Selamat Malam)

Can you help me how can I make it to 4 cases?

Thanks for your great help.

Frank


Arvin Meyer said:
Hi Frank,

You only need 1 label. Using my sample form, change my code to (tested) that
below. You may want to shorten strLen to 30 because there's fewer characters
in your string.

Private Sub Form_Timer()

Static strMsg As String
Static intLet As Integer
Static intLen As Integer
Dim strTmp As String
Dim strGreeting As String
Dim t As Double
Const strLen = 40

t = Time()

Select Case t
Case Is < 0.5
strGreeting = "Selamat Pagi"
Case 0.5 To 0.75
strGreeting = "Selamat Siang"
Case Is > 0.75
strGreeting = "Selamat Malam"
Case Else
MsgBox "Fix your computer's clock"
Exit Sub
End Select

If Len(strMsg) = 0 Then
strMsg = Space(strLen) & strGreeting
intLen = Len(strMsg)
End If

intLet = intLet + 1

If intLet > intLen Then
intLet = 1
End If

strTmp = Mid(strMsg, intLet, strLen)

Me!lblScroll.Caption = strTmp

If strTmp = Space(strLen) Then
intLet = 1 'Re-start scrolling
End If

End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
Frank Situmorang said:
The problem Arvin, coz I have 3 conditional wecoming word, and I tried
them
this way but does not work.

Private Sub Form_Timer()
'When the database is opened display welcome user message.
Dim strMsg As String
Static I As Integer
If Time() < 0.5 Then
[lblMorning].Visible = True
[lblAfternoon].Visible = False
[LblEvening].Visible = False
I = I + 1
strMsg = "Selamat Pagi"
If I > Len(strMsg) Then I = 1
lblMorning.Caption = lblMorning.Caption & Mid(strMsg, I, 1)
End If
ElseIf Time() > 0.5 And Time() < 0.75 Then
[lblMorning].Visible = False
[lblAfternoon].Visible = True
[LblEvening].Visible = False
I = I + 1
strMsg = "Selamat Siang"
If I > Len(strMsg) Then I = 1
lblAfternoon.Caption = lblAfternoon.Caption & Mid(strMsg, I, 1)
End If
ElseIf Time() > 0.75 Then
[lblMorning].Visible = False
[lblAfternoon].Visible = False
[LblEvening].Visible = True
I = I + 1
strMsg = "Selamat Malam"
If I > Len(strMsg) Then I = 1
LblEvening.Caption = LblEvening.Caption & Mid(strMsg, I, 1)
End If
End If
End Sub

--
H. Frank Situmorang


Arvin Meyer said:
You might want to try the working code in this sample database:

http://www.datastrat.com/Download/Scroll.zip
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Hello,

Can any body help me how to make this 3 conditional welcoming words can
work
true. This is VBA I learned from Database Dev UK.ID :
Private Sub Form_Timer()
Dim strMsg As String
Static I As Integer
I = I + 1
strMsg = "Selamat Pagi "
If I > Len(strMsg) Then I = 1
lblMorning.Caption = lblMorning.Caption & Mid(strMsg,
I,
1)
End Sub

While this is the VBA to make a scrolling words:
Private Sub Form_Timer()
Dim strMsg As String
Static I As Integer
I = I + 1
strMsg = "Some message here "
If I > Len(strMsg) Then I = 1
LabelName.Caption = LabelName.Caption & Mid(strMsg, I, 1)
End Sub

MY QUESTION IS HOW CAN WE COMBINE THESE 2 VBA TO MAKE IT WORKS IN THE
ABOVE
3 CONDITIONAL WORDS.

Thanks in advance,
 
S

Steve Sanford

PMFJI,

Try

Select Case t
'From 00.01(night) am to 10:59 a.m
Case Is < 0.458
strGreeting = "Selamat Pagi"
'from 11 am to 2:59 pm
Case 0.458 To 0.6236
strGreeting = "Selamat Siang"
'from 3 pm to 6 p.m
Case 0.625 To 0.75
strGreeting = "Selamat Sore"
'from 6:01 pm to Midnight
Case Is > 0.75
strGreeting = "Selamat Malam"
Case Else
MsgBox "Fix your computer's clock"
Exit Sub
End Select


HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


Frank Situmorang said:
Thank you very much Arvin, it works great for me. I am not so clear about
timing, so I can not modify it to adjust to Indonesian greetings, In
Indonesia is as follows:

1. From 00.00(night) am to 11 a.m we say Good Morning ( Selamat Pagi)
2. from 11 a.m to 3 p.m we say Good Noon ( Selamat Siang)
3. from 3.p,m to 6 p.m we say Good afternoon ( Selamat Sore)
4. From 6 p.m to 12 p.m we say Good Night ( Selamat Malam)

Can you help me how can I make it to 4 cases?

Thanks for your great help.

Frank


Arvin Meyer said:
Hi Frank,

You only need 1 label. Using my sample form, change my code to (tested) that
below. You may want to shorten strLen to 30 because there's fewer characters
in your string.

Private Sub Form_Timer()

Static strMsg As String
Static intLet As Integer
Static intLen As Integer
Dim strTmp As String
Dim strGreeting As String
Dim t As Double
Const strLen = 40

t = Time()

Select Case t
Case Is < 0.5
strGreeting = "Selamat Pagi"
Case 0.5 To 0.75
strGreeting = "Selamat Siang"
Case Is > 0.75
strGreeting = "Selamat Malam"
Case Else
MsgBox "Fix your computer's clock"
Exit Sub
End Select

If Len(strMsg) = 0 Then
strMsg = Space(strLen) & strGreeting
intLen = Len(strMsg)
End If

intLet = intLet + 1

If intLet > intLen Then
intLet = 1
End If

strTmp = Mid(strMsg, intLet, strLen)

Me!lblScroll.Caption = strTmp

If strTmp = Space(strLen) Then
intLet = 1 'Re-start scrolling
End If

End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
Frank Situmorang said:
The problem Arvin, coz I have 3 conditional wecoming word, and I tried
them
this way but does not work.

Private Sub Form_Timer()
'When the database is opened display welcome user message.
Dim strMsg As String
Static I As Integer
If Time() < 0.5 Then
[lblMorning].Visible = True
[lblAfternoon].Visible = False
[LblEvening].Visible = False
I = I + 1
strMsg = "Selamat Pagi"
If I > Len(strMsg) Then I = 1
lblMorning.Caption = lblMorning.Caption & Mid(strMsg, I, 1)
End If
ElseIf Time() > 0.5 And Time() < 0.75 Then
[lblMorning].Visible = False
[lblAfternoon].Visible = True
[LblEvening].Visible = False
I = I + 1
strMsg = "Selamat Siang"
If I > Len(strMsg) Then I = 1
lblAfternoon.Caption = lblAfternoon.Caption & Mid(strMsg, I, 1)
End If
ElseIf Time() > 0.75 Then
[lblMorning].Visible = False
[lblAfternoon].Visible = False
[LblEvening].Visible = True
I = I + 1
strMsg = "Selamat Malam"
If I > Len(strMsg) Then I = 1
LblEvening.Caption = LblEvening.Caption & Mid(strMsg, I, 1)
End If
End If
End Sub

--
H. Frank Situmorang


:

You might want to try the working code in this sample database:

http://www.datastrat.com/Download/Scroll.zip
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Hello,

Can any body help me how to make this 3 conditional welcoming words can
work
true. This is VBA I learned from Database Dev UK.ID :
Private Sub Form_Timer()
Dim strMsg As String
Static I As Integer
I = I + 1
strMsg = "Selamat Pagi "
If I > Len(strMsg) Then I = 1
lblMorning.Caption = lblMorning.Caption & Mid(strMsg,
I,
1)
End Sub

While this is the VBA to make a scrolling words:
Private Sub Form_Timer()
Dim strMsg As String
Static I As Integer
I = I + 1
strMsg = "Some message here "
If I > Len(strMsg) Then I = 1
LabelName.Caption = LabelName.Caption & Mid(strMsg, I, 1)
End Sub

MY QUESTION IS HOW CAN WE COMBINE THESE 2 VBA TO MAKE IT WORKS IN THE
ABOVE
3 CONDITIONAL WORDS.

Thanks in advance,
 
F

Frank Situmorang

Thank you very much Steve and Arvin, it works great for Indonesian style of
greetings

Sincerely,
--
H. Frank Situmorang


Steve Sanford said:
PMFJI,

Try

Select Case t
'From 00.01(night) am to 10:59 a.m
Case Is < 0.458
strGreeting = "Selamat Pagi"
'from 11 am to 2:59 pm
Case 0.458 To 0.6236
strGreeting = "Selamat Siang"
'from 3 pm to 6 p.m
Case 0.625 To 0.75
strGreeting = "Selamat Sore"
'from 6:01 pm to Midnight
Case Is > 0.75
strGreeting = "Selamat Malam"
Case Else
MsgBox "Fix your computer's clock"
Exit Sub
End Select


HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


Frank Situmorang said:
Thank you very much Arvin, it works great for me. I am not so clear about
timing, so I can not modify it to adjust to Indonesian greetings, In
Indonesia is as follows:

1. From 00.00(night) am to 11 a.m we say Good Morning ( Selamat Pagi)
2. from 11 a.m to 3 p.m we say Good Noon ( Selamat Siang)
3. from 3.p,m to 6 p.m we say Good afternoon ( Selamat Sore)
4. From 6 p.m to 12 p.m we say Good Night ( Selamat Malam)

Can you help me how can I make it to 4 cases?

Thanks for your great help.

Frank


Arvin Meyer said:
Hi Frank,

You only need 1 label. Using my sample form, change my code to (tested) that
below. You may want to shorten strLen to 30 because there's fewer characters
in your string.

Private Sub Form_Timer()

Static strMsg As String
Static intLet As Integer
Static intLen As Integer
Dim strTmp As String
Dim strGreeting As String
Dim t As Double
Const strLen = 40

t = Time()

Select Case t
Case Is < 0.5
strGreeting = "Selamat Pagi"
Case 0.5 To 0.75
strGreeting = "Selamat Siang"
Case Is > 0.75
strGreeting = "Selamat Malam"
Case Else
MsgBox "Fix your computer's clock"
Exit Sub
End Select

If Len(strMsg) = 0 Then
strMsg = Space(strLen) & strGreeting
intLen = Len(strMsg)
End If

intLet = intLet + 1

If intLet > intLen Then
intLet = 1
End If

strTmp = Mid(strMsg, intLet, strLen)

Me!lblScroll.Caption = strTmp

If strTmp = Space(strLen) Then
intLet = 1 'Re-start scrolling
End If

End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
The problem Arvin, coz I have 3 conditional wecoming word, and I tried
them
this way but does not work.

Private Sub Form_Timer()
'When the database is opened display welcome user message.
Dim strMsg As String
Static I As Integer
If Time() < 0.5 Then
[lblMorning].Visible = True
[lblAfternoon].Visible = False
[LblEvening].Visible = False
I = I + 1
strMsg = "Selamat Pagi"
If I > Len(strMsg) Then I = 1
lblMorning.Caption = lblMorning.Caption & Mid(strMsg, I, 1)
End If
ElseIf Time() > 0.5 And Time() < 0.75 Then
[lblMorning].Visible = False
[lblAfternoon].Visible = True
[LblEvening].Visible = False
I = I + 1
strMsg = "Selamat Siang"
If I > Len(strMsg) Then I = 1
lblAfternoon.Caption = lblAfternoon.Caption & Mid(strMsg, I, 1)
End If
ElseIf Time() > 0.75 Then
[lblMorning].Visible = False
[lblAfternoon].Visible = False
[LblEvening].Visible = True
I = I + 1
strMsg = "Selamat Malam"
If I > Len(strMsg) Then I = 1
LblEvening.Caption = LblEvening.Caption & Mid(strMsg, I, 1)
End If
End If
End Sub

--
H. Frank Situmorang


:

You might want to try the working code in this sample database:

http://www.datastrat.com/Download/Scroll.zip
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Hello,

Can any body help me how to make this 3 conditional welcoming words can
work
true. This is VBA I learned from Database Dev UK.ID :
Private Sub Form_Timer()
Dim strMsg As String
Static I As Integer
I = I + 1
strMsg = "Selamat Pagi "
If I > Len(strMsg) Then I = 1
lblMorning.Caption = lblMorning.Caption & Mid(strMsg,
I,
1)
End Sub

While this is the VBA to make a scrolling words:
Private Sub Form_Timer()
Dim strMsg As String
Static I As Integer
I = I + 1
strMsg = "Some message here "
If I > Len(strMsg) Then I = 1
LabelName.Caption = LabelName.Caption & Mid(strMsg, I, 1)
End Sub

MY QUESTION IS HOW CAN WE COMBINE THESE 2 VBA TO MAKE IT WORKS IN THE
ABOVE
3 CONDITIONAL WORDS.

Thanks in advance,
 
A

Arvin Meyer [MVP]

So let me alter the code for your timings below:

Select Case t
Case Is < 0.4584
strGreeting = "Selamat Pagi"
Case 0.4584 To 0.625
strGreeting = "Selamat Siang"
Case Is > 0.625
strGreeting = "Selamat Malam"
Case Else
MsgBox "Fix your computer's clock"
Exit Sub
End Select

--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Frank Situmorang said:
Thank you very much Arvin, it works great for me. I am not so clear about
timing, so I can not modify it to adjust to Indonesian greetings, In
Indonesia is as follows:

1. From 00.00(night) am to 11 a.m we say Good Morning ( Selamat Pagi)
2. from 11 a.m to 3 p.m we say Good Noon ( Selamat Siang)
3. from 3.p,m to 6 p.m we say Good afternoon ( Selamat Sore)
4. From 6 p.m to 12 p.m we say Good Night ( Selamat Malam)

Can you help me how can I make it to 4 cases?

Thanks for your great help.

Frank


Arvin Meyer said:
Hi Frank,

You only need 1 label. Using my sample form, change my code to (tested)
that
below. You may want to shorten strLen to 30 because there's fewer
characters
in your string.

Private Sub Form_Timer()

Static strMsg As String
Static intLet As Integer
Static intLen As Integer
Dim strTmp As String
Dim strGreeting As String
Dim t As Double
Const strLen = 40

t = Time()

Select Case t
Case Is < 0.5
strGreeting = "Selamat Pagi"
Case 0.5 To 0.75
strGreeting = "Selamat Siang"
Case Is > 0.75
strGreeting = "Selamat Malam"
Case Else
MsgBox "Fix your computer's clock"
Exit Sub
End Select

If Len(strMsg) = 0 Then
strMsg = Space(strLen) & strGreeting
intLen = Len(strMsg)
End If

intLet = intLet + 1

If intLet > intLen Then
intLet = 1
End If

strTmp = Mid(strMsg, intLet, strLen)

Me!lblScroll.Caption = strTmp

If strTmp = Space(strLen) Then
intLet = 1 'Re-start scrolling
End If

End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
Frank Situmorang said:
The problem Arvin, coz I have 3 conditional wecoming word, and I tried
them
this way but does not work.

Private Sub Form_Timer()
'When the database is opened display welcome user message.
Dim strMsg As String
Static I As Integer
If Time() < 0.5 Then
[lblMorning].Visible = True
[lblAfternoon].Visible = False
[LblEvening].Visible = False
I = I + 1
strMsg = "Selamat Pagi"
If I > Len(strMsg) Then I = 1
lblMorning.Caption = lblMorning.Caption & Mid(strMsg, I, 1)
End If
ElseIf Time() > 0.5 And Time() < 0.75 Then
[lblMorning].Visible = False
[lblAfternoon].Visible = True
[LblEvening].Visible = False
I = I + 1
strMsg = "Selamat Siang"
If I > Len(strMsg) Then I = 1
lblAfternoon.Caption = lblAfternoon.Caption & Mid(strMsg, I,
1)
End If
ElseIf Time() > 0.75 Then
[lblMorning].Visible = False
[lblAfternoon].Visible = False
[LblEvening].Visible = True
I = I + 1
strMsg = "Selamat Malam"
If I > Len(strMsg) Then I = 1
LblEvening.Caption = LblEvening.Caption & Mid(strMsg, I, 1)
End If
End If
End Sub

--
H. Frank Situmorang


:

You might want to try the working code in this sample database:

http://www.datastrat.com/Download/Scroll.zip
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Hello,

Can any body help me how to make this 3 conditional welcoming words
can
work
true. This is VBA I learned from Database Dev UK.ID :
Private Sub Form_Timer()
Dim strMsg As String
Static I As Integer
I = I + 1
strMsg = "Selamat Pagi "
If I > Len(strMsg) Then I = 1
lblMorning.Caption = lblMorning.Caption &
Mid(strMsg,
I,
1)
End Sub

While this is the VBA to make a scrolling words:
Private Sub Form_Timer()
Dim strMsg As String
Static I As Integer
I = I + 1
strMsg = "Some message here "
If I > Len(strMsg) Then I = 1
LabelName.Caption = LabelName.Caption & Mid(strMsg, I, 1)
End Sub

MY QUESTION IS HOW CAN WE COMBINE THESE 2 VBA TO MAKE IT WORKS IN
THE
ABOVE
3 CONDITIONAL WORDS.

Thanks in advance,
 
F

Frank Situmorang

Thank you Arvin, Steve already helped me to make it into 4 cases. We are from
the developping country feel indebted to all of you. Again, thank you very
much and may god richly bless you all.

Frank
--
H. Frank Situmorang


Arvin Meyer said:
So let me alter the code for your timings below:

Select Case t
Case Is < 0.4584
strGreeting = "Selamat Pagi"
Case 0.4584 To 0.625
strGreeting = "Selamat Siang"
Case Is > 0.625
strGreeting = "Selamat Malam"
Case Else
MsgBox "Fix your computer's clock"
Exit Sub
End Select

--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Frank Situmorang said:
Thank you very much Arvin, it works great for me. I am not so clear about
timing, so I can not modify it to adjust to Indonesian greetings, In
Indonesia is as follows:

1. From 00.00(night) am to 11 a.m we say Good Morning ( Selamat Pagi)
2. from 11 a.m to 3 p.m we say Good Noon ( Selamat Siang)
3. from 3.p,m to 6 p.m we say Good afternoon ( Selamat Sore)
4. From 6 p.m to 12 p.m we say Good Night ( Selamat Malam)

Can you help me how can I make it to 4 cases?

Thanks for your great help.

Frank


Arvin Meyer said:
Hi Frank,

You only need 1 label. Using my sample form, change my code to (tested)
that
below. You may want to shorten strLen to 30 because there's fewer
characters
in your string.

Private Sub Form_Timer()

Static strMsg As String
Static intLet As Integer
Static intLen As Integer
Dim strTmp As String
Dim strGreeting As String
Dim t As Double
Const strLen = 40

t = Time()

Select Case t
Case Is < 0.5
strGreeting = "Selamat Pagi"
Case 0.5 To 0.75
strGreeting = "Selamat Siang"
Case Is > 0.75
strGreeting = "Selamat Malam"
Case Else
MsgBox "Fix your computer's clock"
Exit Sub
End Select

If Len(strMsg) = 0 Then
strMsg = Space(strLen) & strGreeting
intLen = Len(strMsg)
End If

intLet = intLet + 1

If intLet > intLen Then
intLet = 1
End If

strTmp = Mid(strMsg, intLet, strLen)

Me!lblScroll.Caption = strTmp

If strTmp = Space(strLen) Then
intLet = 1 'Re-start scrolling
End If

End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
The problem Arvin, coz I have 3 conditional wecoming word, and I tried
them
this way but does not work.

Private Sub Form_Timer()
'When the database is opened display welcome user message.
Dim strMsg As String
Static I As Integer
If Time() < 0.5 Then
[lblMorning].Visible = True
[lblAfternoon].Visible = False
[LblEvening].Visible = False
I = I + 1
strMsg = "Selamat Pagi"
If I > Len(strMsg) Then I = 1
lblMorning.Caption = lblMorning.Caption & Mid(strMsg, I, 1)
End If
ElseIf Time() > 0.5 And Time() < 0.75 Then
[lblMorning].Visible = False
[lblAfternoon].Visible = True
[LblEvening].Visible = False
I = I + 1
strMsg = "Selamat Siang"
If I > Len(strMsg) Then I = 1
lblAfternoon.Caption = lblAfternoon.Caption & Mid(strMsg, I,
1)
End If
ElseIf Time() > 0.75 Then
[lblMorning].Visible = False
[lblAfternoon].Visible = False
[LblEvening].Visible = True
I = I + 1
strMsg = "Selamat Malam"
If I > Len(strMsg) Then I = 1
LblEvening.Caption = LblEvening.Caption & Mid(strMsg, I, 1)
End If
End If
End Sub

--
H. Frank Situmorang


:

You might want to try the working code in this sample database:

http://www.datastrat.com/Download/Scroll.zip
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Hello,

Can any body help me how to make this 3 conditional welcoming words
can
work
true. This is VBA I learned from Database Dev UK.ID :
Private Sub Form_Timer()
Dim strMsg As String
Static I As Integer
I = I + 1
strMsg = "Selamat Pagi "
If I > Len(strMsg) Then I = 1
lblMorning.Caption = lblMorning.Caption &
Mid(strMsg,
I,
1)
End Sub

While this is the VBA to make a scrolling words:
Private Sub Form_Timer()
Dim strMsg As String
Static I As Integer
I = I + 1
strMsg = "Some message here "
If I > Len(strMsg) Then I = 1
LabelName.Caption = LabelName.Caption & Mid(strMsg, I, 1)
End Sub

MY QUESTION IS HOW CAN WE COMBINE THESE 2 VBA TO MAKE IT WORKS IN
THE
ABOVE
3 CONDITIONAL WORDS.

Thanks in advance,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top