Results 1 to 7 of 7
  1. #1
    Join Date
    May 2004

    Unanswered: Running message box only first time form is opened

    Hello again,

    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).

    Thanks very much


  2. #2
    Join Date
    May 2004
    Moscow, Russia
    save key into registry at first startup

    see savesetting (...) help

  3. #3
    Join Date
    May 2004
    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")
    end if

    end sub

    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.


  4. #4
    Join Date
    Feb 2004
    One Flump in One Place
    Hi Grace

    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 ( 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...."
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Mar 2004
    There are several third-party controls that make it easy to modify the registry.

    You can download one for free here:

    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!

  6. #6
    Join Date
    May 2004
    How about using the

    SaveSetting "MyApp", "appName", "SN", "This is a test"

    GetSetting(appname:="MyApp", section:="appName", Key:="SN", Default:="25")

    DeleteSetting "MyApp", "appName"

    I use them a lot in the VB6 applications and found them in the Help files for Access.


  7. #7
    Join Date
    Apr 2004
    outside the rim
    I like the Table idea for a several reasons:

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts