Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 5th, 2004, 03:04 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 451
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Ben Horne
Default Message Appears Only Once When Form Is Opened

Hi all,

Right now I have this little bit of VBA code inside my Music Inventory database that displays a message when the user opens the form. The code is below

Private Sub Form_Open(Cancel As Integer)
' Display a message when the user opens the form,

    Dim strMsg As String, strTitle As String
    Dim intStyle As Integer

    strMsg = "FOR ANY NEW AUDIO LOOPS THAT HAVE NOT YET BEEN SUBMITTED TO FLASH KIT, THE STATUS NEEDS TO BE SET TO FLASH KIT SUBMISSION PENDING. THIS DOES NOT APPLY TO FULL-LENGTH SONGS"
    intStyle = vbOKOnly
    strTitle = "RE: FruityLoops Studio 4 Renders"

    MsgBox strMsg, intStyle, strTitle
    Cancel = False
End Sub



How can I modify the code so that the message appears only once when the user first opens the form?

Ben Horne
Madison Area Technical College - Truax
3550 Anderson Street
Madison, Wisconsin 53704-2599


-------------------------
http://community.webshots.com/user/valerian114

"There are two kinds of people in the world: Those who claim to be Flash junkies and those who actually are Flash junkies"
__________________
Ben Horne
-------------------------
I don\'t want to sound like I haven\'t made any mistakes. I\'m confident I have.

Most likely using FireFox and concocting my next Macromedia Flash project
Snibworks Forums Moderator

Welcome to the New Age
 
Old July 5th, 2004, 05:02 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

Hi Ben,

How 'bout a global variable in a standard module:

Public g_blnByPassOpenEvent As Boolean

and a conditional statement in your Open event so that the code only runs if the condition evaluates to True:

Private Sub Form_Open(Cancel As Integer)
    If Not g_blnByPassOpenEvent Then
        MsgBox "test"
    End If
    g_blnByPassOpenEvent = True
End Sub

HTH,

Bob



 
Old July 5th, 2004, 05:15 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

...or just hide the form instead of closing it(i.e., toggle Visible property)...






Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying message on the form nasirmunir Javascript How-To 3 June 4th, 2008 10:20 PM
Error Message when publishing the form Arsi BOOK: Professional Outlook 2007 Programming ISBN: 978-0-470-04994-5 6 November 19th, 2007 04:25 PM
How to Close a Form when already Opened in C# akumarp2p C# 1 December 4th, 2006 09:45 PM
How to know a form is opened by a particular form johnsonlim026 ASP.NET 1.0 and 1.1 Basics 1 July 13th, 2005 12:39 PM
"Ghost Form Appears" dbkester Access 2 October 3rd, 2003 09:19 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.