Solved

have bmp img file on form appear to be flashing

Posted on 2012-04-03
5
302 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
[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
  • 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
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…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

734 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