Solved

have bmp img file on form appear to be flashing

Posted on 2012-04-03
5
298 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
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 …

758 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

20 Experts available now in Live!

Get 1:1 Help Now