Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / March 2005

Tip: Looking for answers? Try searching our database.

Slidding text

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Luis - 09 Mar 2005 11:55 GMT
Hello.
I'm trying to create a form with a text box that displays the contents of a
certain recordset with the slidding efect. The solution i've found is
displaying character by character with a certain time interval between then.
The problem is that this only works if the textbox has the focus. Can anyone
give me a hint on solving this? The code i'm using is the following:

Option Compare Database
Private rst_alarmes As DAO.Recordset
Private Declare Sub sapisleep Lib "Kernel32" Alias "Sleep" (ByVal
dwMilliseconds As Long)

Private Sub Form_Load()
   Set rst_alarmes = CurrentDb.OpenRecordset("Alarmes", dbOpenSnapshot)
   Me.TimerInterval = 10000
End Sub

Private Sub Form_Timer()
   If rst_alarmes.EOF Then
       rst_alarmes.MoveFirst
       str_alarme = rst_alarmes!ElementoRede & " - " &
rst_alarmes!Indicador & " - " & rst_alarmes!Valor & " - " & rst_alarmes!data
       tam = Len(str_alarme)
       For k = tam To 0 Step -1
           retira = tam - k
           Valor_t = Left(str_alarme, retira)
           Me.AlarmesTxt.Value = Valor_t
           Call sSleep(100)
       Next k
   Else
       str_alarme = rst_alarmes!ElementoRede & " - " &
rst_alarmes!Indicador & " - " & rst_alarmes!Valor & " - " & rst_alarmes!data
       tam = Len(str_alarme)
       For k = tam To 0 Step -1
           retira = tam - k
           Valor_t = Left(str_alarme, retira)
           Me.AlarmesTxt.Value = Valor_t
           Call sSleep(100)
       Next k
       rst_alarmes.MoveNext
   End If

End Sub

Sub sSleep(lngMillisec As Long)
   If lngMillisec > 0 Then
       Call sapisleep(lngMillisec)
   End If
End Sub
Tim Ferguson - 09 Mar 2005 18:20 GMT
> Can anyone
> give me a hint on solving this?

Wouldn't it be easier to buy an ActiveX ticker control?

Tim F
RD - 09 Mar 2005 20:31 GMT
>Hello.
>I'm trying to create a form with a text box that displays the contents of a
>certain recordset with the slidding efect. The solution i've found is
>displaying character by character with a certain time interval between then.
>The problem is that this only works if the textbox has the focus. Can anyone
>give me a hint on solving this? The code i'm using is the following:

<snip>

I found the following on tek-tips.com.  I haven't tried it so I won't
vouch for it.

A scrolling text box
How do I make text scroll like a marquee
faq181-86
Posted: Jun 21, 2000 (Edited Jun 14, 2004)

Step1 create an unbound textbox or a label
Step2 Paste this code in the forms code section

//////////////////////////////////
'start paste
Private Static Function Scrolltext(Strfield As String) As String
‘call from on timer event
Dim astr As Integer
Dim TextLen As Integer
 
  astr = astr + 1
  TextLen = Len(Strfield)
  If astr >= TextLen Then astr = 1
   Scrolltext = Mid([Strfield], astr, Len([Strfield])) & &quot;
&quot; & Left([Strfield], astr)
                               
  End Function

end paste
////////////////////////////////////
Step 3  Call the function from the forms on timer event
For any text
Me!text1.text =  Scrolltext("Hello World") 'Refer to the unbound text
box

For a label
Me.label1.caption = Scrolltext("Hello World")

To use data from a field

Me.text1.text= Scrolltext(me.fieldname) or me.label1.caption =
scrolltext(me.fieldname)

Step 4 set the forms timer interval. The higher the number the slower
it scrolls around 100 is usually good enough

Step 5 Open the form then sit back and watch your text scroll by.

Spell Out
'spells out word call from timer event
Private Static Function SpellOut(strMessage As String) As String

Dim iCount As Integer
Dim iLen As Integer
                               
  iLen = Len(strMessage)
  If iCount >= iLen Then iCount = 1
   
  SpellOut = Left(strMessage, iCount)
  iCount = iCount + 1
   
   End Function

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.