The refresh time of a function is too short which results in an infinite loop. (1 Viewer)

I've been out of town for a family function so just got back now. I see that Josef P. already asked a question I would have asked. But I'll rephrase it into a comment.

When you use a continuous form (and it appears that you did exactly that), there is only one row, only one set of controls. Access re-uses the form for each row that it displays. So if you click on a text box you have to first determine WHICH row you just selected - because technically, you are selecting the same control no matter which row you click in. Your complaint that you sometimes get the wrong row is because you are somehow being careless with record selection. Given this problem, I suspect that your previously described issue with that loop is partly because you are not properly clearing alarms anyway, so they don't go away. I don't see where you are obtaining record information regarding WHICH row you are currently examining, but with a backlog of events, you have to remember that multiple events CAN fire without regard to which record is currently selected. That will be part of the confusion. Look up .RecordSelector and understand that your code cannot presume that the current record (on the form) is the one that triggered the alarm. You need to convert some of this to use action queries to UPDATE certain fields to zero in the record you just clicked, which first involves determining the record number and then determining the PK of the table holding the continuously displayed data. Search around in the forum for more on the subject of continuous forms.

Gasman's comment is relevant to this because you can end up in a complex subroutine with code that uses two different spellings of what should be the same variable. But using Option Explicit or checking that Tools/Options setting would help a lot to avoid that. The setting IS slightly a pain in the toches because it requires you to DIM every variable, but it catches every case where you mistyped a name.
 
Thanks for explaining it in detail, I have a better understanding of the problem now, but I think I need some more time to figure out how the continuous form works, I started learning VBA last month and still have a lot to learn. 😞😞😔😔
 
Thanks for explaining it in detail, I have a better understanding of the problem now, but I think I need some more time to figure out how the continuous form works, I started learning VBA last month and still have a lot to learn. 😞😞😔😔

When I first started with Access, I wasn't always the quickest guy with an answer either. But you learn by doing, as do most of us. Access DOES have a steep learning curve and I don't think any of us would strongly dispute that statement.

The thing that will help you most in this forum is to remember that we are neither subject-matter experts in your problem's subject, nor mind-readers. Therefore, when expressing your problem, use more language than code and try to be clear. (That's ANOTHER skill that you learn by doing.) Displaying code specifics works if it is a code problem - but if it is an inherent data flaw (as one possible example), we couldn't tell by looking at the code. Stay more with language and post code when prompted to do so. And PLEASE don't take this statement as saying that your earlier posts are bad or inappropriate. You are still learning Access AND our forum. We can be patient about that.

Something that I don't yet understand, and it relates to the start of your problem... In English, what triggers your alarm? Do you have some kind of timer event code? How do you know that something needs an alarm? Or perhaps... WHEN do you know that something needs an alarm?
 
Thanks for explaining it in detail, I have a better understanding of the problem now, but I think I need some more time to figure out how the continuous form works, I started learning VBA last month and still have a lot to learn. 😞😞😔😔

Sorry but the Pause I suggested doesn't let you do anything 'during' it, it's a real Pause - a complete pause, vba-wise at least.
But it (can potentially be) great for letting windows do its thing - like releasing a file that needs a few seconds to show as released.
 
When I first started with Access, I wasn't always the quickest guy with an answer either. But you learn by doing, as do most of us. Access DOES have a steep learning curve and I don't think any of us would strongly dispute that statement.

The thing that will help you most in this forum is to remember that we are neither subject-matter experts in your problem's subject, nor mind-readers. Therefore, when expressing your problem, use more language than code and try to be clear. (That's ANOTHER skill that you learn by doing.) Displaying code specifics works if it is a code problem - but if it is an inherent data flaw (as one possible example), we couldn't tell by looking at the code. Stay more with language and post code when prompted to do so. And PLEASE don't take this statement as saying that your earlier posts are bad or inappropriate. You are still learning Access AND our forum. We can be patient about that.

Something that I don't yet understand, and it relates to the start of your problem... In English, what triggers your alarm? Do you have some kind of timer event code?

The system compares the current time and the end time (the time started the timer + the time selected for count down), if they are the same, an "alarm" word will appear in the text box, which is no longer a null/empty box, which triggers the alert. Which is a part of the timer event? I am not really sure...

I have a drop list allowing the user to pick the time (from 1 minute to 2 hours) they want to set in the timer. I guess when the "alarm" word appears then I know the time is up and it needs to alarm.
 
Sorry but the Pause I suggested doesn't let you do anything 'during' it, it's a real Pause - a complete pause, vba-wise at least.
But it (can potentially be) great for letting windows do its thing - like releasing a file that needs a few seconds to show as released.

It's ok, this pause function honestly helped me a lot, I guess I will implement this function in the system if I can't build the most desired one.
 
The system compares the current time and the end time (the time started the timer + the time selected for count down), if they are the same, an "alarm" word will appear in the text box, which is no longer a null/empty box, which triggers the alert. Which is a part of the timer event? I am not really sure...

This is the part that is confusing. We see the END of the process where you have an alarm and want to silence it. But if we don't know the beginning of the process, it gets tricky. On the other hand, I begin to sense that I better understand WHY you reach that saturation point. If this is not on a timer, though, then your code has no time to manipulate things because you never leave event context. That's why you have trouble with unresponsive clicks that never let you catch up.

And I still didn't see an answer to a question I asked earlier. You were given the program to maintain after someone else built it. You are still struggling to maintain it. Am I right?
 
This is the part that is confusing. We see the END of the process where you have an alarm and want to silence it. But if we don't know the beginning of the process, it gets tricky. On the other hand, I begin to sense that I better understand WHY you reach that saturation point. If this is not on a timer, though, then your code has no time to manipulate things because you never leave event context. That's why you have trouble with unresponsive clicks that never let you catch up.

And I still didn't see an answer to a question I asked earlier. You were given the program to maintain after someone else built it. You are still struggling to maintain it. Am I right?
Yes. 😅
 

Users who are viewing this thread

Back
Top Bottom