Solved Display a message to the user at Intervals.

HillTJ

To train a dog, first know more than the dog..
Local time
Yesterday, 22:26
Joined
Apr 1, 2019
Messages
731
Friends, This must be simple. I currently capture the number of times a particular form is open. At intervals, say after every 100 openings, i wish to advise the user. Just cannot think whether there is a simple routine to do this. Direction would be appreciated. Cheers.
 
Capture the number of times where? Divide the count by 100 and if there is no remainder, pop up message. Use MOD:

If x MOD 100 = 0 Then
 
@June7 , to answer your question i have a counter on the main form that increments by 1 each time the form is opened & saves that value. So will this method work with 'each' 100. That is opened 100, then 200 iterations etc ?. I've not had experience with the 'mod' function so will have a play. Cheers.
 
how about if the count reaches 98 then the db is closed and re-opened?
will it continue saving at starting at 99 or on opening the db (and opening the form)?
or will it reset to zero on every opening of the db?
 
how about if the count reaches 98 then the db is closed and re-opened?
will it continue saving at starting at 99 or on opening the db (and opening the form)?
A do while loop should work here

the while clause will be count <100
 
@arnelgp , the 'count' is saved each time the database is closed via an update query. I want to print a message after each 100 openings, that is 100, 200, 300 etc.I'd assume that @June7 's approach would do that as say at 100 openings, 200 openings etc then the if statement would be true?. I'll mock it up and trial some numbers. Cheers.
 
All did a mock up. 'Mod' works a treat, really simple. Something new learnt. Thanks all.
 
You should keep the count in a table and open a recordset in the Open event of the form. Add 1 to the current value and update the record. Then check the value and if it is 100 or divisible by 100 evenly, if that is what you want, then display a message. Make sure that you keep a separate record for each user in the table unless you don't care who opens the form only how many times it gets opened.

This seems like a bizarre requirement but who am I to question it?
 
Pat, i wish to identify how often my application is used (opened). I figure, a reminder to me, every 100 uses may be reasonable. Ideally, i'd like the application to send me an email including the actual number of uses so i can keep track. This is only an idea. I currently keep a running total of "openings" and display this on the main screen. This all works with the mod function, but i cannot figure how to send an email without either a warning message or opening the email for the user to approve first. I'm playing with 'sendoject' at the moment. Any ideas?
 
I can send emails without warning or user action as long as Microsoft Virus Protection is up to date. Look at Outlook File > Options > Trust Center Settings > Programmatic Access.
 
@June7 , What if the users PC Microsoft Virus Protection is not up to date?. Will they see the 'warning'? I'm Playing with the following code. Just wanted to silently send myself a periodic status email.

Code:
Private Sub Counter_AfterUpdate()' mock up form to test concept only.
If Me.Counter Mod 100 = 0 Then
MsgBox "Counted"
DoCmd.SendObject acSendNoObject, , , "XXXX@XXXX.com", , , "Email Test", "This is the email Body", False
End If
End Sub
 
I don't remember if SendObject or Outlook automation or both will trigger warning. SendObject will possibly result in email saved in their SENT folder. Use Outlook automation to prevent saving in SENT.
 
@June7 , i've reached a similar conclusion. My research reveals that the 'sendobject' method, although simple, pops up the warning message. I use outlook automation for other email stuff. I normally select .display so the user can review the email, but will use .send instead and see if that gives me what i need. Cheers
 
If you have access to the BE, you don't need to use email. Just log the opens from the form's Open event. You can then run queries on the log table to gather whatever info you want.

Displaying a message to the user is different from sending one to the developer. It helps us all if you try to be more precise with your descriptions.
 
Hey Pat, the application has been deployed. Split database of course. I totally agree with you, but i only have access to the BE when onsite ( infrequent these days) & wish to periodically get a feel for how much use the database is put to. It's a new application & i just wish to monitor usage. Yes, i could have used the forms open event to trigger the counter & i could also capture the date/time too. Just never thought of that technique, but i'm all up for learning something new! I've resorted to outlook automation for the email stuff. Thanks.
 

Users who are viewing this thread

Back
Top Bottom