On Not In List event

Jon123

Registered User.
Local time
Today, 04:39
Joined
Aug 29, 2003
Messages
668
I have a combo box that is getting its value from a command button.
After the value is entered by code I then have code running the AfterUpdate
event. Now I also have code in the On Not In List and the property value Limit to list is set to yes. If I enter a value that is not in the list manually then my On Not in list code works. If I use code to enter a value that is not in the list it seems to ignore the On Not in List code. Is there away to catch this and code it or am I stuck.

jon
 
You should be able to use the Dcount function to check for a match in your table an perform a surrogate Not In List event. It would look something like;

Code:
If DCount("[FieldName]", "TBL_Author", "[FieldName] = 'ValueTryingToAssignToCombo'") = 0 Then
        MsgBox "That Value is not in the list"
        Exit Sub
End If
 
This is what I have but it always returns the msg that the part is on the list.


If DCount("[PartNumber]", "[Tble-Parts Lookup]", "[Partnumber] = 'Me.pn1'") = 1 Then


jon
 
Last edited:
This is what I have but it always returns the msg that the part is on the list.


If DCount("[PartNumber]", "[Tble-Parts Lookup]", "[Partnumber] = 'Me.pn1'") = 1 Then


jon

Jon,

If DCount ... =1 that means it found one.
I think you should change your =1 to =0.
If Dcount .... =0 it means none were found
 

Users who are viewing this thread

Back
Top Bottom