Solved

Make button Blink/Flash issue

Posted on 2008-10-18
6
857 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
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!

 
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

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)

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
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…

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