Unanswered: Running message box only first time form is opened
Could anybody help me in finding a way to run a message box (via a macro, perhaps) when the main switchboard (using autoexec) is opened, but only the first time it's opened (so that the poor user isn't bombarded with the same alert every time he/she runs the program).
I think I would just have a global variable of Boolean type. When the form is loaded, it checks the variable for true. If it is false, the msg box loads and the variable is set to true. From then on, no more loading of msgbox.
public varMsgBox as Boolean
private sub form_load()
if varMsgBox then
varMsgBox = True
msgbox("show a message")
This way, you don't have to go screwing with the registry files which can get you into trouble if you aren't familiar with them. Since you asked the question, it appears you aren't.
I think playing around with the registry may go a bit far too (this is still for your project, yeah? Are you able to change registry settings?). Also, that won't help if the user moves computers.
The global variable is recreated each time the application opens so that won't meet your requirement (as I read it anyway) either.
A possibility might be: could create a two field table where the user name and date\ time are stored. Check the table for the logged on user using a DLookup (http://www.dbforums.com/t999028.html) on the table- if there is no username, show the message box. Either way, next run an insert SQL statement inserting User Name and Now() into the table. This performs your function and you also have a log of everytime a user uses you database too.
Hope this helps
Gizza shout if you get stuck on DLookup or "INSERT INTO...."
Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!
Or try our Ask An Expert service to answer any of your questions!
1) it's internal
2) it works for users who have no rights what-so-ever (and would not be able to modify the registry)
3) it can follow the user to any workstation
4) it is readily expandable:
a) you may want to track user statistics, like frequency of use, last use, last workstation used on.
b) you may eventually want to start "remembering" other user preferences as well
and the most important:
KISS: Keep It Short & Simple