Solved

How to create Blinking text in Access form

Posted on 2009-04-01
15
659 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
[X]
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
  • 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

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…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
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 …

752 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