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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suppressing the Not in List system message box 1

Status
Not open for further replies.

oddball

Technical User
Mar 17, 2000
64
GB
I am causing a form to open when the 'Not in List' event occurs to a combo box, to allow a value to be entered to a table. This works fine but How do I stop the Info Message Box appearing, which says:<br><br>The Text you entered isnt an item in the List.<br><br>It doesnt seem to respond to: <br><br>'On Error'<br><br>or 'If DataErr = ...'<br><br>ways to supress most system errors.<br><br>Regards,<br><br>Simon Osborne
 
Here is some code you can try.&nbsp;&nbsp;This is a procedure I placed in a recent app<br><br>Private Sub Design_Analyst_NotInList(NewData As String, Response As Integer)<br><br>&nbsp;&nbsp;&nbsp;&nbsp;' Add a new person by typing a name in combo box.<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Dim intNewTeamMember As Integer, strTitle As String, intMsgDialog As Integer<br><br>&nbsp;&nbsp;&nbsp;&nbsp;' Display message box asking if user wants to add a new person.<br>&nbsp;&nbsp;&nbsp;&nbsp;strTitle = &quot;Analyst Not In List&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;intMsgDialog = vbYesNo + vbQuestion + vbDefaultButton1<br>&nbsp;&nbsp;&nbsp;&nbsp;intNewTeamMember = MsgBox(&quot;Do you want to add a new name?&quot;, intMsgDialog, strTitle)<br><br>If intNewTeamMember = vbYes Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Remove new name from combo box so<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' control can be requeried when user returns to form.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DoCmd.RunCommand acCmdUndo<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Open AddTeamMember form.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DoCmd.OpenForm &quot;frmAddTeamMember&quot;, acNormal, , , acAdd, acDialog, NewData<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Continue without displaying default error message.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Response = acDataErrAdded<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Response = acDataErrContinue<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End If<br><br>End Sub<br><br>Mike<br><br><A HREF="mailto:michaelj1@home.com">michaelj1@home.com</A>
 
Thanks, MichealJ for &quot;DoCmd.RunCommand acCmdUndo&quot;<br><br>I have a million of these NotOnList events and I've never thought of just removing the entry! (Duh...) I always just told the users when I was training that they should respond to the message by removing the incorrect entry and adding the correct&nbsp;&nbsp;one. I thought this was a good safeguard since they should rarely if ever add to the lookup tables, but an empty control (if they tried to leave without entering the new value) will be less confusing for any new user. Honestly, it's these little things that can make all the difference to a user!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top