Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Syuppress ACCESS Informational/Error Message? 2

Status
Not open for further replies.

khwaja

Technical User
Aug 27, 2001
431
AU
I have a form with a combo field showing drop down options. I have selected the property 'Limit to list' to avoid unwanted entires. However, I also wanted to give user a choice to user to either select from the list (if there was a mistake) or go to a form where more options can be added. I therefore created an error message using dialogue box style form with a 'Cancel' and 'Add More Options' buttons and added the name of this form to 'On Not in List' property of the control. However, on testing drop down list, I noticed that Access also produces an error message saying 'The text you entered isn't in the list'. When you hit OK button, my error message appears next.

I have tried looking for a way to suppress Access informational message but could not find any relevant help. Could someone help me so that I am able to show my own error message only when user tries to enter text not on the list.

Cheers
 
Thanks Terry.

I tried using set warning command when initially I decided to open my dialogue form using a macro. I placed the set warning command first followed by open form command but it did not work. Then I created the following code which did not have any set warning code previously but I added this based on your response but it still does not work. Please treat me ignorant in terms of VB code and if you could kindly fix it I will be grateful.

Private Sub CustomerTypeID_NotInList(NewData As String, Response As Integer)
On Error Resume Next
DoCmd.SetWarnings False
DoCmd.OpenForm "Error Dialogue"
End Sub

Regards
 
You have to set warnings off before the user enters anything in the combo box. By the time the NotInList event fires Access will have already displayed the warning message. You could put the Set Warning command in the Form_Open event or the combo box Enter event if you only want to turn off warnings when the combo is in use. Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions in the SQL Server forum. Many of the ideas apply to all forums.
 
Thanks Terry. I tried it both ways, but this continues to return system message. For your convenience, I have reproduced the event procedure.

Private Sub CustomerTypeID_Enter()
DoCmd.SetWarnings False
End Sub

Private Sub CustomerTypeID_NotInList(NewData As String, Response As Integer)
On Error Resume Next
DoCmd.OpenForm "Error Dialogue"
End Sub

Private Sub Form_Open(Cancel As Integer)
DoCmd.SetWarnings False
End Sub

Regards
 
Okay, finally got back to this. You may have already found the answer. If not, it is quite simple in the case of the NotInList event. Set the value of Response.

Private Sub CustomerTypeID_NotInList _
(NewData As String, Response As Integer)

'Continue without displaying system message
Response = acDataErrContinue

DoCmd.OpenForm "Error Dialogue"

End Sub

See details in the Access Help topic, "NotInList Event — Event Procedures" Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions in the SQL Server forum. Many of the ideas apply to all forums.
 
Many many thanks. It worked and it is still not late.

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top