A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

NotInList How to eliminate System Generated Error



 
 
Thread Tools Display Modes
  #1  
Old June 28th, 2005, 06:25 PM
10SNUT
external usenet poster
 
Posts: n/a
Default NotInList How to eliminate System Generated Error


I am using the following code. Everything works EXCEPT after the
message I put in the code, I get the system generated message: "The
item you selected is not in the list - Please select...." How do I
eliminate that message??


I have LimitToList set to YES, and this code is in the NotInList
property.



Option Compare Database
Option Explicit

Private Sub ContractorName_NotInList(NewData As String, Response As
Integer)


If MsgBox("Do you want to add '" _
& NewData & "' to the list of contractors?", _
vbOKCancel, "Add New Item") = vbOK Then

' Remove new data from combo box so control can be requeried
' after the Form1 form is closed
DoCmd.RunCommand acCmdUndo

' Display form to collect data needed for the new record
DoCmd.OpenForm "Form1", acNormal, , , acAdd, acDialog,
NewData

'Continue without displaying default error message.
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If

End Sub

Thanks for your assistance in advance,
10SNUT


--
10SNUTPosted from http://www.pcreview.co.uk/ newsgroup access

  #2  
Old June 28th, 2005, 06:50 PM
RuralGuy
external usenet poster
 
Posts: n/a
Default

10SNUT 10SNUT.1rck5b@ wrote:


I am using the following code. Everything works EXCEPT after the
message I put in the code, I get the system generated message: "The
item you selected is not in the list - Please select...." How do I
eliminate that message??


I have LimitToList set to YES, and this code is in the NotInList
property.



Option Compare Database
Option Explicit

Private Sub ContractorName_NotInList(NewData As String, Response As
Integer)


If MsgBox("Do you want to add '" _
& NewData & "' to the list of contractors?", _
vbOKCancel, "Add New Item") = vbOK Then

' Remove new data from combo box so control can be requeried
' after the Form1 form is closed

*** JUST REMOVE THIS CODE ***
*** DoCmd.RunCommand acCmdUndo

' Display form to collect data needed for the new record
DoCmd.OpenForm "Form1", acNormal, , , acAdd, acDialog,
NewData

'Continue without displaying default error message.
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If

End Sub

Thanks for your assistance in advance,
10SNUT


Hi 10SNUT,

I answered it of the other thread. Thanks for posting your code
and the problem.

HTH

--
RuralGuy

Please reply to the newsgroup so all may benefit.
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Eliminate error "The outlook file was not closed properly" RicardoRG General Discussion 2 May 2nd, 2005 01:51 PM
MAPISP32.exe has generated error and will be closed by windows jwkalaij General Discussion 1 January 14th, 2005 10:46 AM
Query too complex and system resources exceeded error shannonh General Discussion 1 October 1st, 2004 02:04 PM
Visual Basic Error Messages in Office Apps Paul Jordan General Discussions 2 August 6th, 2004 03:49 PM
1706 error for one user on a multiuser winxp system jcg Setup, Installing & Configuration 2 July 17th, 2004 03:52 PM


All times are GMT +1. The time now is 05:52 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.