Solved

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

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
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.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

760 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now