Solved

How to create Blinking text in Access form

Posted on 2009-04-01
15
619 Views
Last Modified: 2013-11-28
Morning Experts,

I have an end user very eager to add blinking text to a value being displaye via a form.  Essentially i created a function as the conditional and want to assign the same value the blinking attirbute.  Most example i have come across seem to conflict with the displayed time being displayed on the same form.  Im thinking this can be done but am at a loss on how to do it... any help is greatly appreciated.  Of course the end user wanted this done last week.  
If custAgent(sn("cust_number")) Then

            Forms!f_builder.txtCustNum = sn("Customer_number")

            Forms!f_builder.txtXCustNum.ForeColor = 255

        

        Else

            Forms!f_builder.txtCustNum = IIf(IsNull(sn("Customer_number")), "", sn("Customer_number"))

        End If

Open in new window

0
Comment
Question by:thirsty4knowledge
  • 9
  • 5
15 Comments
 

Author Comment

by:thirsty4knowledge
ID: 24039238
This is the code setting the timer.
Private Sub Form_Timer()

    Me!lblClock.Caption = Format(Now, "dddd, mmm d yyyy, hh:mm:ss AMPM")

End Sub

Open in new window

0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 24039338
try this

Private Sub Form_Timer()
    Me!lblClock.Caption = Format(Now, "dddd, mmm d yyyy, hh:mm:ss AMPM")

    me.lblClock.ForeColor = (IIf(.ForeColor = vbRed, vbBlack, vbRed))
End Sub
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 24039350
oops

try this

Private Sub Form_Timer()
with Me!lblClock
    .Caption = Format(Now, "dddd, mmm d yyyy, hh:mm:ss AMPM")

    .ForeColor = (IIf(.ForeColor = vbRed, vbBlack, vbRed))
end with
End Sub
0
 

Author Comment

by:thirsty4knowledge
ID: 24039399
Thanks capricorn,

But the timer is not the code im looking to update it's just the issue that conflicts with the text of the txtCustNum I want to assign the blinking attribute.  Best case scenario i want to just update the if statement with a link that adds the blinking capability.  Hope im being clear.    
0
 
LVL 77

Expert Comment

by:peter57r
ID: 24039495
There is no blinking attribute in Access.
You have to use the timer to toggle colours.
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 24039528
are you calling the codes in the form f_builder?

0
 

Author Comment

by:thirsty4knowledge
ID: 24039530
Ok, it seems like ive seen blinking text in access before.  If i alternate the text between red and white i might accomplish the same effect.  How would i accomplish the toggling between the colours??
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

Author Comment

by:thirsty4knowledge
ID: 24039544
yes, Form f_builder is the form name.
0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 24039568
you se the timer interval in the current event of the form

private sub form_current()

If custAgent(sn("cust_number")) Then
     me.timerinterval=300
end if

end sub

now use the timer event
Private Sub Form_Timer()
with Forms!f_builder.txtXCustNum
    .ForeColor = (IIf(.ForeColor = vbRed, vbBlack, vbRed))

end with
End Sub
0
 

Author Comment

by:thirsty4knowledge
ID: 24040223


Capricorn,
Thanks alot, that works perfect.. i just changed the black to white to make it look a little better.  I have a question to feel a lil better about pushing this into production.  I moved the code into the onload sub as that's where all the other code was being executed.  Will this create a problem and also there is another "Me.timerInterval" statement in the code for the "clockstart" fuctionality.  Why is the code not conflicting... ?  Im not complaining as you will get the points just wanted to know what's going on behind that scenes a lil more.  Hope im being clear.


Private Sub Form_Load()

     custAgent(sn("cust_number")) Then

            Me.TimerInterval = 90

            Forms!f_builder.txtXCustNum = sn("Customer_number")

            Forms!f_builder.txtXCustNum.ForeColor = 255

        

        Else

            Forms!f_builder.txtXCustNum = IIf(IsNull(sn("Customer_number")), "", sn("Customer_number"))

        End If
 

end sub
 

Private Sub Form_Timer()
 

    With Forms!f_builder.txtXCustNum

        .ForeColor = (IIf(.ForeColor = vbRed, vbWhite, vbRed))

    End With
 
 

    Me!lblClock.Caption = Format(Now, "dddd, mmm d yyyy, hh:mm:ss AMPM")

End Sub
 

   

Open in new window

0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 24040309
the Load event only fires when the form is loaded, the current event also fires.
when you moved to another record, the Load event  does not fire, current event fires again...

so use the forms current event instead of the load event
0
 

Author Comment

by:thirsty4knowledge
ID: 24040367
Ok, ill update the current sub.  Can you enlighten me on why the  two "Me.TimerInterval = 90" codes are non-conflicting?

Private Sub cmdClockStart_Click()

    Me.TimerInterval = 1000

End Sub

Private Sub cmdClockEnd_Click()

    Me.TimerInterval = 0

End Sub

Open in new window

0
 

Author Comment

by:thirsty4knowledge
ID: 24040572
Ok, i commented out all the "Me.TimerInterval = " assignment statements and the text is still blinking where is the speed of the blinking being assigned..?
0
 

Author Comment

by:thirsty4knowledge
ID: 24040606
Maybe theres a default speed and the "Me.TimerInterval =" is just over writting that value??
0
 

Author Comment

by:thirsty4knowledge
ID: 24041275
Ok, my question is how can i switch between to way of displaying the text associated with the blinking.  Meaning if this is true show this (blinking text) if not show this ( non-blinking text) same value.  Looks like putting it in the timer() sub executes that code every couple of minutes and it's tie up access.  
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now