Solved

How to create Blinking text in Access form

Posted on 2009-04-01
15
649 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

685 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