Solved

Make button Blink/Flash issue

Posted on 2008-10-18
6
869 Views
Last Modified: 2012-05-05
Experts,

I have the following code below and it works good but it seems to cause some kind of issue in the code window (when hit alt F-11).  What happens is difficult to explain but it is affecting my typing in the window.  I need the code to only execute if the frmFacilityDetails is open.  I think that might correct the typing issue I have in the code of other forms.  Maybe this issue is known by another expert.  

Private Sub Form_Timer()

    'FLASH OF NOTES TEXT BOX.
'IT WORKS ANDISTHEONLY PLACEI NEED IT...NOCURRENT EVENT.
Static blnRed As Boolean
If Nz(DCount("FacilityDetailsID", "tblNotesPerFacility", "FacilityDetailsID= " & Nz(Me!FacilityDetailsID.Value, 0)), 0) > 0 Then
    If blnRed = True Then
        Me.txtNotes2.ForeColor = 255
        Me.txtNotes2.FontBold = True
        blnRed = False
    Else
        Me.txtNotes2.ForeColor = vbBlack
        Me.txtNotes2.FontBold = False
        blnRed = True
    End If
Else
End If

End Sub
0
Comment
Question by:Petrobras
[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
  • 4
  • 2
6 Comments
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 500 total points
ID: 22748897
try breaking your codes in the current event and timer event

private sub form_current()

If Nz(DCount("FacilityDetailsID", "tblNotesPerFacility", "FacilityDetailsID= " & Nz(Me!FacilityDetailsID.Value, 0)), 0) > 0 Then

me.timerinterval=300
end if

end sub

private sub form_timer()
with me.txtNotes2
       .forecolor=iif(.forecolor=vbred,vbblack,vbred)
       .fontbold=iif(.fontbold=true,false,true)
end with
end sub
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 22748950


private sub form_timer()
Static blnRed As Boolean
with me.txtNotes2
    If blnRed = True Then
        .ForeColor = 255
        .FontBold = True
        blnRed = False
    Else
        .ForeColor = vbBlack
        .FontBold = False
        blnRed = True
    End If
end with
end sub
0
 

Author Comment

by:Petrobras
ID: 22749121
Capricorn, I made the changes (Using the second on timer event posted).  The problem now is that the button blinks all the time when going from record to record instead of blinking when there is a record in tblNotesPerFacility based on the current [FacilityDetailsID].  

What do you think now?
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 22749339


private sub form_current()

If Nz(DCount("FacilityDetailsID", "tblNotesPerFacility", "FacilityDetailsID= " & Nz(Me!FacilityDetailsID.Value, 0)), 0) > 0 Then

me.timerinterval=300

else

me.timerinterval=0
end if
0
 

Author Comment

by:Petrobras
ID: 22749394
worked perfectly.  Thank you sir...
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 22749437
you are welcome!!!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
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 …

726 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