473,385 Members | 1,944 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Activating Timer after an event

68 64KB
Hi,
I have a for in my database with several fields. Now I want for the timer to be activated after entering data into a particular field. I have this but I am not getting the result.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.     If Me.Number = "*" Then
  3.         Me.TimerInterval = 500
  4.     Else
  5.         Me.TimerInterval = 0
  6.         Me.lblProcessing.Visible = False
  7.     End If
  8. End Sub
Expand|Select|Wrap|Line Numbers
  1.     With Me.lblProcessing
  2.         .Visible = Not Me.lblProcessing.Visible
  3.     End With
Can anyone help me out on what I am doing wrong here?
Thanks,
Feb 18 '13 #1
8 6366
NeoPa
32,556 Expert Mod 16PB
Stoic:
Now I want for the timer to be activated after entering data into a particular field.
Your explanation doesn't match the code. The code checks each record it finds.

For your second code block you give no clues as to where it is found. As such, it is almost no indication of anything at all.

I suspect if you work a little on your question we will be in a position to be able to help without having to guess too much of what you really want. This should suit everyone.
Feb 18 '13 #2
Rabbit
12,516 Expert Mod 8TB
You probably think that Me.Number = "*" will be true if there's anything in the field. That's not correct. An equal operator does not accept wild cards. What you need to do instead is check that the length of the field is larger than 1.
Feb 18 '13 #3
TheSmileyCoder
2,322 Expert Mod 2GB
Curios why do you need the timer?
Anyway, as rabbit says there are various ways to check for data.

One is:
Expand|Select|Wrap|Line Numbers
  1. IF len(Me.Number & "")>0 then
The & "" ensures that should the field be empty (null) then that is handled as well.

Another approach if you want to be more specific (based on the name of your control might be to use the IsNumeric function.
Feb 18 '13 #4
Stoic
68 64KB
Thanks guys for the efforts so far. I inadvertently forgot to include where my second code is. Here is my thought.
I have several fields on my form. Among the fields, I have a field called Number. I also have a label called lblProcessing placed in the form property timer to alternate/flash. Now, I want for the timer to be activated after updating the 'Number' field; when timer is activated, the label 'lblProcessing' will flash, else the timer interval is set at 0 and nothing which means the Number field is empty. My first code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.     If Me.Number = "*" Then
  3.         Me.TimerInterval = 500
  4.     Else
  5.         Me.TimerInterval = 0
  6.         Me.lblProcessing.Visible = False
  7.     End If
  8. End Sub
says if the number field is updated then the timer is activated the the 'lblProcessing' label is visible and flashes, else the timer is set at 0 and the 'lblProcessing label stops flashing and not visible.

My second code
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Timer()
  2.     With Me.lblProcessing
  3.         .Visible = Not Me.lblProcessing.Visible
  4.     End With
  5. End Sub
runs the timer for the 'lblProcessing' label to flash if the timer is activated.

I hope I have provided some clarity.
Thanks
Feb 19 '13 #5
TheSmileyCoder
2,322 Expert Mod 2GB
The forms current event is fired each time you navigate to a different (or new) record in your form. I think you need to code it differently based on what you have described.

A single procedure to check:
Expand|Select|Wrap|Line Numbers
  1. Private Sub UpdateTimer()
  2.     If IsNumeric(Me.Number) Then
  3.         Me.TimerInterval = 500
  4.     Else
  5.         Me.TimerInterval = 0
  6.         Me.lblProcessing.Visible = False
  7.     End If
  8. End Sub
With code in both the FORMS current and the NUMBER CONTROL's afterupdate:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.   Call UpdateTimer
  3. End Sub
  4.  
  5. Private Sub Number_AfterUpdate()
  6.   Call UpdateTimer
  7. End Sub
Hope that Helps.
Feb 19 '13 #6
Stoic
68 64KB
Thanks TheSmileyCoder, but it didn't work.
Feb 19 '13 #7
NeoPa
32,556 Expert Mod 16PB
Stoic:
I want for the timer to be activated after updating the 'Number' field; when timer is activated, the label 'lblProcessing' will flash, else the timer interval is set at 0 and nothing which means the Number field is empty.
As Smiley indicated (and I did earlier also) this is just not logical. The value in your [Number] control can be non-blank without it having been changed in the current sesssion. Your response is very helpful certainly, and leaving bits out of the question is an oversight that many members make. It would probably be helpful if you could resolve for us exactly what you do mean here though. Is it when this value is changed that you want it to flash or is it when the value is other than Null (blank)?
Stoic:
Thanks TheSmileyCoder, but it didn't work.
A perfectly polite and friendly response, but we also need information when something fails. Was there an error message? Were the results other than you expected with no crash? Just saying it doesn't work is generally not very much to work with ;-)

For the UpdateTimer procedure I'd suggest :
Expand|Select|Wrap|Line Numbers
  1. Private Sub UpdateTimer()
  2.     With Me
  3.         .TimerInterval = IIf(IsNull(.Number), 0, 500)
  4.         .lblProcessing.Visible = (.TimerInterval > 0)
  5.     End With
  6. End Sub
For the Timer procedure itself :
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Timer()
  2.     With Me.lblProcessing
  3.         .Visible = Not .Visible
  4.     End With
  5. End Sub
Feb 19 '13 #8
Stoic
68 64KB
Thanks for the efforts guys. I just added the code to the afterupdate for the Number field and it worked.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Number_AfterUpdate()
  2. If Me.Number > 0 Then
  3.         Me.TimerInterval = 500
  4.     Else
  5.         Me.TimerInterval = 0
  6.         Me.lblProcessing.Visible = False
  7.     End If
  8. End Sub
Feb 19 '13 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Mr. B | last post by:
My current app has a timer that I kick ON in my Form1_Load as follows: ' Set Up the Timer Function Dim t As New System.Timers.Timer(12000) ' 1000 = 1 Second t.Enabled = True ' False to Turn OFF...
13
by: Manuel Lopez | last post by:
I have a puzzling form timer problem that I didn't experience prior to Access 2003 (though I'm not sure access 2003 is to blame). Here's the situation: a computer has two access 2003 databases on...
10
by: Wayne Aprato | last post by:
I have a database that was written in Access 2003 using the Access 2000 file format. When I run the mdb in Access 2003 everything works fine. If I run it in Access 2000 the timer event won't fire...
5
by: caulker | last post by:
I have a windows service with a Timer which runs just fine on my Development machine, but the "timer_elapsed" is not being executed on the Production machine. same .exe on both machines. i'm...
2
by: Anders | last post by:
Hi all, I have two classes: Form1 and GrabTitle Form1 instantiates GrabTitle In GrabTitle there is a Timer event which calls several events in Form1. The strange thing is that one event...
9
by: Tolga Tanriverdi | last post by:
I wrote a program which includes a timer event in it but if my program executes on windows 98 the timer event is not running is something like that possible Thanks
1
by: BC | last post by:
Hi all, I have two classes: TransactionCollection and Transaction, where TransactionCollection is used to store Transaction objects. public class TransactionCollection : CollectionBase {...
4
by: sophistiKate | last post by:
I am working with an Access 2003 database. Since adding a timer event to check for idle time to a form, a custom toolbar button that creates a snapshot has stopped working properly. Until the first...
7
by: =?Utf-8?B?YWxiZXJ0b3Nvcmlh?= | last post by:
Hi everybody, I'm using a system.timers.timer object like this: Dim aTimer As New System.Timers.Timer() In my page_load event I use this: aTimer.Interval = 5000 aTimer.Enabled = True...
2
by: Salad | last post by:
This was an interesting problem. I open a form, CalledForm. When a record is presented in CalledForm I needed to check the status of something. If the status is met, I needed to present...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.