?
Solved

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

Posted on 2011-09-19
4
Medium Priority
?
252 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 2000 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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

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.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

770 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