Not in list code does not trigger ???

Jon123

Registered User.
Local time
Yesterday, 21:16
Joined
Aug 29, 2003
Messages
668
I have code in the NotInList property of a combo box but it never triggers.
If I try to enter a value that is not in the list it just opens the combobox list it never runs my code
why?

jon
 
Is the Limit to List property Yes?
 
Yes

Limit to list = Yes
 
What version? If 2007, is code enabled or the file in a trusted location?
 
using 2007
How do I know if the code is enabled? I dont understand what you mean by a trusted location I have other code that runs just fine
 
If other code runs, that's not the problem then. Can you post the db?
 
Ok so I got it working but I need some help combining this code.
The combo box is being is only showing part number that are setup for the chamber type. So the part number may already be in the lookup table but not configured for this chamber type. So I want this code to figure that out and open the right form to either add a new part or open the form to config the part number to the chamber.

Private Sub Part_Number_NotInList(NewData As String, Response As Integer)
On Error GoTo Err_Readme_Click
Dim StdResponse As Integer
DoCmd.SetWarnings False
StdResponse = MsgBox("This Part Number is NOT recorded in the Finger Print. Would you like to add this Part Number?", 52)
If StdResponse = 6 Then 'Yes
DoCmd.OpenForm "Frm-Adding New Parts", acNormal, , , acFormAdd, acDialog
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If

If Not IsNull(DLookup("[Part Number]", "Tble-Parts LookUp", "[Part Number] = '" & Me![Part Number] & "'")) Then
Dim Msg, Style, Title, Help, Ctxt, Response1, MyString
Msg = "Click YES to ADD this PART to another Product - OR - click NO to add a different PART NUMBER."
Style = vbYesNo + vbCritical + vbDefaultButton2
Title = "This Part Number is entered under a different Chamber Type. You can not enter the same part number twice."
Ctxt = 1000
Response1 = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response1 = vbYes Then
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Frm-Adding Productcodes to PartsC"
stLinkCriteria = "[Part Number]=" & "'" & Me![Part Number] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Me.Undo
DoCmd.close acForm, "frm-Adding PartsC"
Exit Sub

Else:
End If
End If
Exit Sub
Me.Undo
Exit_Readme_Click:
Exit Sub
Err_Readme_Click:
MsgBox Err.Description
Resume Exit_Readme_Click
End Sub
 
WE do not know what a "Chamber Type" is but it sounds like you need to have both the "Chamber Type" and the "Part Number" controls complete before doing your Lookup. Would you agree? BTW, I strongly recommend that you *not* have embedded spaces in any of your names. Better to use CamelFontNames or Under_Score_Names if you must.
 

Users who are viewing this thread

Back
Top Bottom