Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create Blinking in a Field 1

Status
Not open for further replies.

dvannoy

MIS
May 4, 2001
2,765
US
Is there a way to make a Field blink on a form???

Thanks in advance
 
Yes, you can use the Form's timer event to change the back color of a field back and forth. ljprodev@yahoo.com
Professional Development
MS Access Applications
 
In the OnTimer Event of your form place this code:

If ControlName.BackColor = 16777215 Then
ControlName.BackColor = 255
Else
ControlName.BackColor = 16777215
End If

Then in timer interval place something like 500 for an interval (adjust to your desire). This will make a control that blinks back and forth between Red and White.
Joe Miller
joe.miller@flotech.net
 
The above code works great! I appreciate it but it causes a little problem..is there a way to stop the timer when a button is pressed...i have a button thats runs a macro that will print a label for the current record on the form..in the macro i set it to print that "id" so just that form prints...with the timer event running it screws it up....

any ideas???

thanks
 
To fix this I would hide a control that has a value that changes when the button is pressed. Then the on timer event can look at that control first to see if it needs to fire off the blink code. So for demonstration let's put in a checkbox control called BlinkControl and we'll use 0 for "No Blink" and -1 for "Blink." Make the controls default value -1 for "Blink." Now our code in the ontimer event changes to this:

If BlinkControl = -1 then
If ControlName.BackColor = 16777215 Then
ControlName.BackColor = 255
Else
ControlName.BackColor = 16777215
End If
End If

Now when your print button is pressed we need to put a line of code at the top that stops the blinking. It goes like this:

BlinkControl = 0

The last step is to modify the OnCurrent event of the form and put in the following line to reset the blinking to "ON" when the user moves between records. That code is:

BlinkControl = -1

Once it's working correctly, set the BlinkControl's Visible property to No and the user won't see it making it nice and clean.

Joe Miller
joe.miller@flotech.net
 
What it does'nt like is the time interval...if i set it to anything other then 0 it wont work....is there a way to set the time interval back to 0 when the print button is pressed...I tryed a couple of things but could not make it work...

Thanks for all your help
 
What is the program doing when you press the print button? Is it erroring? What's the error? Is it not printing the button? Is it going to code in the window and saying that it's invalid? I need a little more to go on.. Joe Miller
joe.miller@flotech.net
 
no errors what happens is, it prints out the form and then will open the report....

PRINT BUTTON

blinkcontrol = 0
DoCmd.RunCommand acCmdRefresh
DoCmd.RunMacro "print drum sample label from form"

MACRO

Azusa Facility Drum Sampling Label
Print Preview
[id]=[Forms]![Print drum sampling sheet]![id]

REPORT ON ACTIVATE

Dim Message, Title, Default
Message = "Enter The Number of Sample Labels To Print For This Line Item "
Title = "Azusa Facility Systems Dept."
MyValue = InputBox(Message, Title)

DoCmd.PrintOut acPrintAll, , , , MyValue
DoCmd.Close


 
Try moving the BlinkControl line underneath the refresh command:

DoCmd.RunCommand acCmdRefresh
blinkcontrol = 0
DoCmd.RunMacro "print drum sample label from form"

See if that fixes it. Joe Miller
joe.miller@flotech.net
 
nope it didnt work....thats ok i can live without it....

Thats just really weird how as soon as i set time interval past 0 this happens..

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top