Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to create Blinking text in Access form

Posted on 2009-04-01
15
641 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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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
 

Author Comment

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

Accepted Solution

by:
Rey Obrero (Capricorn1) 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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
corrupt Databases 9 65
Problem with vba code 4 39
Calculated field not displaying as currency on form 4 20
Access VBA to Count Worksheets in a Workbook 3 22
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
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…

860 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