Solved

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

Posted on 2011-09-19
4
236 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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…

733 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