combo.OnNotInList ?

  • Thread starter Thread starter JethroUK©
  • Start date Start date
J

JethroUK©

OnNotInList doesn't seem to work?

Help menu suggest this is a read/write property (as opposed to the NotInList
event)

If i attempt to read it - it generates an error - e.g.

If cboFILTERS.OnNotInList = True Then
do this
else
do this
end if
 
OnNotInList is a property that tells ACCESS what to do when the NotInList
event occurs: run a macro (the property holds the name of a macro), run an
event procedure (the property holds the text string "[Event Procedure]"),
run a function (the property holds the name of a function), or do nothing
(the property holds an empty string).
 
You may be trying to read the wrong property.

The LimitToList property determines whether the control has the constraint
on it. i.e., this setting determines *whether* the NotInList event fires.
This can be either True of False.

The OnNotInList property determines what happens *when* the NotInList event
fires (True is *not* one of it's possible values)
If i attempt to read it - it generates an error - e.g.
Let me take a guess. You get a "type mismatch" error?
If so, that's because the property returns a string variable, not a boolean.
(It reading the property isn't causing the error, it's attempting to compare
the value returned to True.)

Per the help file entry it will return one of 4 things (as a string),
depending on how the property has been set.
- the name of a macro
- an expression
- "[Event procedure]"
- an empty string

HTH,
 
I was 'hoping' it might save me looking thru the list myself - no such luck
:o) thanks anyhow


Ken Snell said:
OnNotInList is a property that tells ACCESS what to do when the NotInList
event occurs: run a macro (the property holds the name of a macro), run an
event procedure (the property holds the text string "[Event Procedure]"),
run a function (the property holds the name of a function), or do nothing
(the property holds an empty string).

--

Ken Snell
<MS ACCESS MVP>

JethroUK© said:
OnNotInList doesn't seem to work?

Help menu suggest this is a read/write property (as opposed to the
NotInList
event)

If i attempt to read it - it generates an error - e.g.

If cboFILTERS.OnNotInList = True Then
do this
else
do this
end if
 
JethroUK© said:
I was 'hoping' it might save me looking thru the list myself - no
such luck
o) thanks anyhow


Ken Snell said:
OnNotInList is a property that tells ACCESS what to do when the
NotInList event occurs: run a macro (the property holds the name of
a macro), run an event procedure (the property holds the text string
"[Event Procedure]"), run a function (the property holds the name of
a function), or do nothing (the property holds an empty string).

--

Ken Snell
<MS ACCESS MVP>

JethroUK© said:
OnNotInList doesn't seem to work?

Help menu suggest this is a read/write property (as opposed to the
NotInList
event)

If i attempt to read it - it generates an error - e.g.

If cboFILTERS.OnNotInList = True Then
do this
else
do this
end if

What are you trying to do, Jethro? If you have the LimitToList property
set to False (so the user can enter values that aren't in the list), but
you want to know whether the current value of the combo is in the list
or not, you can use the combo box's ListIndex property to tell you. If
the value is not in the list, then the ListIndex property will have a
value of = -1.
 
Dirk Goldgar said:
JethroUK© said:
I was 'hoping' it might save me looking thru the list myself - no
such luck
o) thanks anyhow


Ken Snell said:
OnNotInList is a property that tells ACCESS what to do when the
NotInList event occurs: run a macro (the property holds the name of
a macro), run an event procedure (the property holds the text string
"[Event Procedure]"), run a function (the property holds the name of
a function), or do nothing (the property holds an empty string).

--

Ken Snell
<MS ACCESS MVP>

OnNotInList doesn't seem to work?

Help menu suggest this is a read/write property (as opposed to the
NotInList
event)

If i attempt to read it - it generates an error - e.g.

If cboFILTERS.OnNotInList = True Then
do this
else
do this
end if

What are you trying to do, Jethro? If you have the LimitToList property
set to False (so the user can enter values that aren't in the list), but
you want to know whether the current value of the combo is in the list
or not, you can use the combo box's ListIndex property to tell you. If
the value is not in the list, then the ListIndex property will have a
value of = -1.

I have combo populated with a dozen or preset so filters (for filtering the
form) & also use the same combo to type in manual search

same basic routine with very slight mod if they typed it in manually

Listindex will be perfect to detect this - thanks
 
Back
Top