Solved

How to create Blinking text in Access form

Posted on 2009-04-01
15
614 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
Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

 

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
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…

746 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