my scrolling wolcoming greetings does not work any more

F

Frank Situmorang

Hello.

Chruchdatabase that I am developing is made in many languages, so for the
welcoming greetings also should be made in languages.

It works when I derictly have the string in the VBA, but now it is not
scrolling although it shows in the intended language, what did I miss here,
here is my revised VBA:
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 = 30

t = Time()

Select Case t
'From 00.01(night) am to 10:59 a.m
Case Is < 0.458
' Note: This is message string #1.
strMsg = DLookup("MessageString", "[Lookup Message String_Qry]",
"[FormName] = '" & Me.Name & "' AND [StringNumber] = 1")
strGreeting = [strMsg]
'from 11 am to 2:59 pm
Case 0.458 To 0.6236
' Note: This is message string #2.
strMsg = DLookup("MessageString", "[Lookup Message String_Qry]",
"[FormName] = '" & Me.Name & "' AND [StringNumber] = 2")
strGreeting = [strMsg]
'from 3 pm to 6 p.m
Case 0.6237 To 0.75
' Note: This is message string #3.
strMsg = DLookup("MessageString", "[Lookup Message String_Qry]",
"[FormName] = '" & Me.Name & "' AND [StringNumber] = 3")
strGreeting = [strMsg]
'from 6:01 pm to Midnight
Case Is > 0.75
' Note: This is message string #4.
strMsg = DLookup("MessageString", "[Lookup Message String_Qry]",
"[FormName] = '" & Me.Name & "' AND [StringNumber] = 4")
strGreeting = [strMsg]
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

Thanks in advance
 
M

Michael Gramelspacher

Hello.

Chruchdatabase that I am developing is made in many languages, so for the
welcoming greetings also should be made in languages.

It works when I derictly have the string in the VBA, but now it is not
scrolling although it shows in the intended language, what did I miss here,
here is my revised VBA:
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 = 30

t = Time()

Select Case t
'From 00.01(night) am to 10:59 a.m
Case Is < 0.458
' Note: This is message string #1.
strMsg = DLookup("MessageString", "[Lookup Message String_Qry]",
"[FormName] = '" & Me.Name & "' AND [StringNumber] = 1")
strGreeting = [strMsg]
'from 11 am to 2:59 pm
Case 0.458 To 0.6236
' Note: This is message string #2.
strMsg = DLookup("MessageString", "[Lookup Message String_Qry]",
"[FormName] = '" & Me.Name & "' AND [StringNumber] = 2")
strGreeting = [strMsg]
'from 3 pm to 6 p.m
Case 0.6237 To 0.75
' Note: This is message string #3.
strMsg = DLookup("MessageString", "[Lookup Message String_Qry]",
"[FormName] = '" & Me.Name & "' AND [StringNumber] = 3")
strGreeting = [strMsg]
'from 6:01 pm to Midnight
Case Is > 0.75
' Note: This is message string #4.
strMsg = DLookup("MessageString", "[Lookup Message String_Qry]",
"[FormName] = '" & Me.Name & "' AND [StringNumber] = 4")
strGreeting = [strMsg]
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

Thanks in advance

Frank,

I see this is a rework of Arvin Meyer's code. Try this

Private Sub Form_Timer()

Static strMsg As String
Static intLet As Integer
Static intLen As Integer
Static strMsg1 As String
Static strMsg2 As String
Static strMsg3 As String
Static strMsg4 As String

Dim strTmp As String
Dim strGreeting As String
Dim t As Double
Const strLen = 30

If Len(strMsg1 & "") = 0 Then
strMsg1 = DLookup("MessageString", "[Lookup Message String_Qry]", _
"[FormName] = '" & Me.Name & "' AND [StringNumber] = 1")
strMsg2 = DLookup("MessageString", "[Lookup Message String_Qry]", _
"[FormName] = '" & Me.Name & "' AND [StringNumber] = 2")
strMsg3 = DLookup("MessageString", "[Lookup Message String_Qry]", _
"[FormName] = '" & Me.Name & "' AND [StringNumber] = 3")
strMsg4 = DLookup("MessageString", "[Lookup Message String_Qry]", _
"[FormName] = '" & Me.Name & "' AND [StringNumber] = 4")
End If

t = Time()

Select Case t
Case Is < 0.458
strGreeting = strMsg1

Case 0.458 To 0.6236
strGreeting = strMsg2

Case 0.6237 To 0.75
strGreeting = strMsg3

Case Is > 0.75
strGreeting = strMsg4

Case Else
MsgBox Nz(DLookup("MessageString", "[Lookup Message String]", _
"[FormName] = '" & Me.Name & "' AND [StringNumber] = 5"))
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.Scroll_Label.Caption = strTmp

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

End Sub
 
F

Frank Situmorang

Mike:

Thanks very much for your response, yes I have to admit that I was help by
many people at that time as you can see in the newsgroup.

I have filled out with the one from you and the error message is this:
the expression on open you entered as the event property setting produced
the following error: Method or Data member not found.

Probably because we do not mention it yet that strMsg= strMsg1 or strMsg2 or
strMsg3 or strMsg4.

How can we mention it.

Thanks for your help.
 
F

Frank Situmorang

Mike:

Thanks very much, you are awesome. Pls forget my previous email. It works
now, in fact is that "Me.lblScroll.Caption = strTmp" that I changed from the
one you put previuosly as: Me.Scroll_Label.Caption = strTmp. Coz the name of
the label control is lblScroll.

Thanks very much Mike I have bothered you a lot.



--
H. Frank Situmorang


Michael Gramelspacher said:
Hello.

Chruchdatabase that I am developing is made in many languages, so for the
welcoming greetings also should be made in languages.

It works when I derictly have the string in the VBA, but now it is not
scrolling although it shows in the intended language, what did I miss here,
here is my revised VBA:
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 = 30

t = Time()

Select Case t
'From 00.01(night) am to 10:59 a.m
Case Is < 0.458
' Note: This is message string #1.
strMsg = DLookup("MessageString", "[Lookup Message String_Qry]",
"[FormName] = '" & Me.Name & "' AND [StringNumber] = 1")
strGreeting = [strMsg]
'from 11 am to 2:59 pm
Case 0.458 To 0.6236
' Note: This is message string #2.
strMsg = DLookup("MessageString", "[Lookup Message String_Qry]",
"[FormName] = '" & Me.Name & "' AND [StringNumber] = 2")
strGreeting = [strMsg]
'from 3 pm to 6 p.m
Case 0.6237 To 0.75
' Note: This is message string #3.
strMsg = DLookup("MessageString", "[Lookup Message String_Qry]",
"[FormName] = '" & Me.Name & "' AND [StringNumber] = 3")
strGreeting = [strMsg]
'from 6:01 pm to Midnight
Case Is > 0.75
' Note: This is message string #4.
strMsg = DLookup("MessageString", "[Lookup Message String_Qry]",
"[FormName] = '" & Me.Name & "' AND [StringNumber] = 4")
strGreeting = [strMsg]
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

Thanks in advance

Frank,

I see this is a rework of Arvin Meyer's code. Try this

Private Sub Form_Timer()

Static strMsg As String
Static intLet As Integer
Static intLen As Integer
Static strMsg1 As String
Static strMsg2 As String
Static strMsg3 As String
Static strMsg4 As String

Dim strTmp As String
Dim strGreeting As String
Dim t As Double
Const strLen = 30

If Len(strMsg1 & "") = 0 Then
strMsg1 = DLookup("MessageString", "[Lookup Message String_Qry]", _
"[FormName] = '" & Me.Name & "' AND [StringNumber] = 1")
strMsg2 = DLookup("MessageString", "[Lookup Message String_Qry]", _
"[FormName] = '" & Me.Name & "' AND [StringNumber] = 2")
strMsg3 = DLookup("MessageString", "[Lookup Message String_Qry]", _
"[FormName] = '" & Me.Name & "' AND [StringNumber] = 3")
strMsg4 = DLookup("MessageString", "[Lookup Message String_Qry]", _
"[FormName] = '" & Me.Name & "' AND [StringNumber] = 4")
End If

t = Time()

Select Case t
Case Is < 0.458
strGreeting = strMsg1

Case 0.458 To 0.6236
strGreeting = strMsg2

Case 0.6237 To 0.75
strGreeting = strMsg3

Case Is > 0.75
strGreeting = strMsg4

Case Else
MsgBox Nz(DLookup("MessageString", "[Lookup Message String]", _
"[FormName] = '" & Me.Name & "' AND [StringNumber] = 5"))
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.Scroll_Label.Caption = strTmp

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

End Sub
 

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