Blinking date/text when expiry date approaches - code isn't working?

Sharky II

Registered User.
Local time
Today, 11:55
Joined
Aug 21, 2003
Messages
354
Hi

I'm trying to use the following code (modified from something WayneRyan kindly sent me a while back) to get the text in the date/text box to flash red when the membership expiry date is close (within 30 days):

Code:
Private Sub Form_Current()
  If Abs(DateDiff("d", Me![MembershipExpiryDate], Date)) < 30 Then
     Me![MembershipExpiryDate].ForeColor = 255
  Else
     Me![MembershipExpiryDate].ForeColor = 0
  End If
End Sub

Private Sub Form_Timer()
If Me![MembershipExpiryDate].Visible = True Then
    Me![MembershipExpiryDate].Visible = False
Else
    Me![MembershipExpiryDate].Visible = True
End If

End Sub

Can anyone see where i'm going wrong? It doesn't go red, or flash (like they should when the date is close) and also i get an error 438 'object doesn't support property or object' when viewing some empty fields.

Anyone have any idea? I have set the timer interval to 1000.

Many thanks

Eddie
 
Hi sorry it's flashing now.

However the problem is that i then need to be able to click on it and for it to stop flashing, so i can enter a new date or whatever.

However when i click the flashing textbox, i get run time error 2165 - 'you can't hide a control that has the focus'. The debugger points to the line:

Code:
 Me![MembershipExpiryDate].Visible = False

Is there any way around this?

Thanks
 
I was going to write a reply but decided an example would be easier.

The top text box is the subscription date and the bottom text box is simply there to test the functionality.

Dave
 

Attachments

hi

thanks for that! your example goes red when the date is close to todays date - i'd be happy if mine only did that (minus the blinking, that is), without errors - one thing i noticed is that as soon as your form loaded i got that lost focus error message - but i can't seem to recreate it?

Cheers, i'm still experimenting!
 
yeah got the message again :( i get it every time the form loads.

i also just want the text to blink, not the whole textbox to blink

anyone?
 
Last edited:
can anyone get it so that when i click the flashing textbox it doesn't give the run time error 2165 - 'you can't hide a control that has the focus'?

I just want to be able to click it and edit the date! :confused: So basically i want onclick - stop flashing (ie stop the timer event), but don't know the VB syntax to do this.

Also strangely, at the bottom of the form near the built in access selectors, when the form first loads, i have lost the total number of entries from being displayed. If you click the >| button to go to last record then the number is displayed. :confused: :confused: This has only happened since i got it to start flashing and used this code.

I can make it go red and not flash, and then there's no problem with the losing focus thing. But no. of records won't show. Odd?

Anyone?

Thanks
 
Last edited:

Users who are viewing this thread

Back
Top Bottom