Solved

Make button Blink/Flash issue

Posted on 2008-10-18
6
838 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
  • 4
  • 2
6 Comments
 
LVL 119

Assisted Solution

by:Rey Obrero
Rey Obrero 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 119

Expert Comment

by:Rey Obrero
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
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.

 
LVL 119

Accepted Solution

by:
Rey Obrero 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 119

Expert Comment

by:Rey Obrero
ID: 22749437
you are welcome!!!
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

895 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now