Solved

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

Posted on 2011-09-19
4
248 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

695 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