Solved

I need to close and clear out a Message that is appearing.

Posted on 2011-09-19
4
221 Views
Last Modified: 2012-05-12
I have the following coding on an event button called Open Contact table.  I want to open the Contact Table if a point of Interest Record exists.  The user clicks Yes and the Contact table opens for data entry.

THE CODING:  VBA

Private Sub Command189_GotFocus()
If MsgBox("You Must have a Point of Interest Record First before adding a Contact?  Do you have a Point of Interest Record for a Subject?", 52, "If Yes, the Contact Data Entry Form will load...") = vbYes Then
DoCmd.OpenForm "Contact_tbl"
DoCmd.GoToRecord , , acNewRec
Else

DoCmd.OpenForm "Startup Screen"




End If
End Sub

Ok on the Contact table after a record is added with an Add Record button, I have an After Update Event on the properties of the form with this coding:


Private Sub Form_AfterUpdate()

MsgBox "RECORD HAS BEEN SAVED"
 If MsgBox("Do You Want To Add Vehicles ?", 52, "The Question ...") = vbYes Then
   DoCmd.OpenForm "Vehicles_tbl"
  DoCmd.GoToRecord , , acNewRec
 Else
 If MsgBox("Do You Want To Add Weapons ?", 52, "The Question ...") = vbYes Then
   DoCmd.OpenForm "Weapons_tbl"
  DoCmd.GoToRecord , , acNewRec
 Else
 MsgBox "SINCE YOU DO NOT WISH TO ADD VEHICLES OR WEAPONS, YOU WILL NOW BE RETURNED TO THE MAIN MENU."
 
 DoCmd.OpenForm "StartUp Screen"
 
 End If
End If



End Sub


When the user selects No button on the messages, the Startup Screen LOADS, but has the same Message:

You Must have a Point of Interest Record, blah, Blah, Blah.  I do not want to see this message again!

How can I cancel this message after is used with coding somewhere and where do I put the coding to do so in the after update event of the form properties?





0
Comment
Question by:jjc9809
  • 2
4 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 36561545
Are you sure that the focus is not automatically going back to your button and causing the message to appear again?
0
 
LVL 42

Expert Comment

by:dqmq
ID: 36561598
For Command189 button, use the On Click event, instead of the OnFocus event
0
 
LVL 26

Accepted Solution

by:
Nick67 earned 500 total points
ID: 36563075
Ditto @dqmq
<For Command189 button, use the On Click event, instead of the OnFocus event >
When the other form closes, the focus returns to the button and your event re-fires.
0
 
LVL 26

Expert Comment

by:Nick67
ID: 36569279
Hey,

The catching of the problem being the OnGotFocus() was dqmq
I explained why that was the problem, but he spotted it.
You should split the points, at least
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question