Solved

have bmp img file on form appear to be flashing

Posted on 2012-04-03
5
301 Views
Last Modified: 2012-04-03
hello,
have attached sample db.
open database and form opens.
if you enter 123 for serial number and hit enter- a lemon bmp image file becomes visible-
(logic is if there is more than 2 records with same serial number the image is visible)
question:
Is there a way with timer interval (or something else) to make image look like it is flashing (when it is visible)?
thank you-
Data1.accdb
0
Comment
Question by:davetough
  • 2
  • 2
5 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 37801155
I can't download your database, but this is the basic idea:

In the same code where you make the image visible, add the following line:

Me.TimerInterval = 1000  'This will execute your timer event every second

Open in new window


Then in the timer event:


'This toggles the visibility of the image (flashes it)
Me.imgMyImage.Visible = Not Me.imgMyImage.Visible

Open in new window



And if you want to turn off the timer/flashing:

Me.TimerInterval = 0 'This will turn off your timer and stop the flashing

Open in new window

0
 

Author Comment

by:davetough
ID: 37801322
Thanks- i wonder if my example is corrupted-
i placed code:

Private Sub serial_AfterUpdate()
Me.txtCount = DCount("*", "tblServer", "serial='" & Me.serial & "'")
If Me.txtCount > 2 Then
Me.TimerInterval = 1000
Me.imgLemon.Visible = True

Else
Me.imgLemon.Visible = False
End If

End Sub

in textbox- logic- when more than 2 same serial numbers - image displays-
can i use image like this?

am having hard time finding timerinterval- thought it was just in properties of image?
or maybe am not doing something right here
thank you
0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 37801371
<<thought it was just in properties of image? >>

No... Timer Interval and the Timer Event are associated with the form itself.  So try this:


Private Sub serial_AfterUpdate()
   Me.txtCount = DCount("*", "tblServer", "serial='" & Me.serial & "'")
   If Me.txtCount > 2 Then
      Me.TimerInterval = 1000
      Me.imgLemon.Visible = True

    Else
       Me.imgLemon.Visible = False
       Me.TimerInterval = 0   '<---- This turns off the flashing
   End If

Open in new window


You  might also need the above code in the current event of your form.


And use the timer event of the form as I described earlier:

Private Sub Form_Timer()


'This toggles the visibility of the image (flashes it)
Me.imgLemon.Visible = Not Me.imgLemon.Visible

End Sub

Open in new window

0
 

Author Comment

by:davetough
ID: 37801422
thank you for explanation and code-
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37801453
<No Points wanted>
Just note that the timer is low on the processors priority list.
So the flashing may not be as "Consistent" as you might want...

For example this might be an ideal  1 second Flash:
On..........Off..........On..........Off..........ON..........Off

But in reality the flashing might end up being like this:
On..........Off................On..Off.......ON..Off.............
(Not here that the "Total Time" is the same, but the flashing is irregular)

...So the flashing may be off depending on what else the computer has running.

It also can cause odd things to happen if you open the VB editor while it is running.

JeffCoachman
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
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 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…
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…

830 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