Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Value pushed to textbox doesn't invoke LimittoList

Geek News

Value pushed to textbox doesn't invoke LimittoList
moosecck[ at ]gmail.com 12/16/2008 7:45:46 PM
I have a form that uses a combo box called txt_Status with 3 options,
Draft, In Process and Approved. When the Status box is Approved, it
pushes the persons name from the thru code by using Environ
("Username") to a combo box called txt_Senior. Txt_Senior is a combo
box with 6 persons names in the list. It also has Limit to List
enabled. I have code in the Not in List of txt_Senior that tells
anyone whose name is not in the list to see their supervisor. My
problem is when the persons name is pushed into the txt_Senior box
where the Limit to List is enabled and the persons name is not in the
list, the NotInList code is not triggered. If I type the same name
into the txt_Senior box the NotInList code is triggered. Why is it
that when the name is pushed in the code does not work but when I type
the same name into the txt_Senior box the NotInList code is triggered?

Re: Value pushed to textbox doesn't invoke LimittoList
mat <mat[ at ]notarealdotcom.adr> 12/16/2008 8:20:41 PM
In article <6e586148-1533-4da8-bd00-52e0d7890bb5
[ at ]o40g2000prn.googlegroups.com>, moosecck[ at ]gmail.com says...
[Quoted Text]
> I have a form that uses a combo box called txt_Status with 3 options,
> Draft, In Process and Approved. When the Status box is Approved, it
> pushes the persons name from the thru code by using Environ
> ("Username") to a combo box called txt_Senior. Txt_Senior is a combo
> box with 6 persons names in the list. It also has Limit to List
> enabled. I have code in the Not in List of txt_Senior that tells
> anyone whose name is not in the list to see their supervisor. My
> problem is when the persons name is pushed into the txt_Senior box
> where the Limit to List is enabled and the persons name is not in the
> list, the NotInList code is not triggered. If I type the same name
> into the txt_Senior box the NotInList code is triggered. Why is it
> that when the name is pushed in the code does not work but when I type
> the same name into the txt_Senior box the NotInList code is triggered?
>
>
I'm not sure why this is true but by design many form events are only
triggered by user interactions. Seemingly parallel actions carried out
in code don't trigger the events.

I've not needed to deal with the specific issue you've asked about, but
you should be able to work around it by testing the list in code for a
match, and if a match is not found, fire the not in list event.
Re: Value pushed to textbox doesn't invoke LimittoList
"Dirk Goldgar" <dg[ at ]NOdataSPAMgnostics.com.invalid> 12/16/2008 8:49:14 PM
<moosecck[ at ]gmail.com> wrote in message
news:6e586148-1533-4da8-bd00-52e0d7890bb5[ at ]o40g2000prn.googlegroups.com...
[Quoted Text]
>I have a form that uses a combo box called txt_Status with 3 options,
> Draft, In Process and Approved. When the Status box is Approved, it
> pushes the persons name from the thru code by using Environ
> ("Username") to a combo box called txt_Senior. Txt_Senior is a combo
> box with 6 persons names in the list. It also has Limit to List
> enabled. I have code in the Not in List of txt_Senior that tells
> anyone whose name is not in the list to see their supervisor. My
> problem is when the persons name is pushed into the txt_Senior box
> where the Limit to List is enabled and the persons name is not in the
> list, the NotInList code is not triggered. If I type the same name
> into the txt_Senior box the NotInList code is triggered. Why is it
> that when the name is pushed in the code does not work but when I type
> the same name into the txt_Senior box the NotInList code is triggered?


The NotInList event is triggered by user action, not by assigning a value in
code. Access tends to assume that if the developer is assigning a value
(via code), it must be valid. If you need to, you can make your own test to
see if the name is valid, either by checking it against the combo box's list
or by checking it against the combo's rowsouce. Or you can assign the value
to the combo and then check the combo's ListIndex property to see if the
value you assigned is valid (the ListIndex will be -1 if the value is not in
the list).

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

Re: Value pushed to textbox doesn't invoke LimittoList
Marshall Barton <marshbarton[ at ]wowway.com> 12/19/2008 5:12:16 AM
mat wrote:

[Quoted Text]
>In article <6e586148-1533-4da8-bd00-52e0d7890bb5
>[ at ]o40g2000prn.googlegroups.com>, moosecck[ at ]gmail.com says...
>> I have a form that uses a combo box called txt_Status with 3 options,
>> Draft, In Process and Approved. When the Status box is Approved, it
>> pushes the persons name from the thru code by using Environ
>> ("Username") to a combo box called txt_Senior. Txt_Senior is a combo
>> box with 6 persons names in the list. It also has Limit to List
>> enabled. I have code in the Not in List of txt_Senior that tells
>> anyone whose name is not in the list to see their supervisor. My
>> problem is when the persons name is pushed into the txt_Senior box
>> where the Limit to List is enabled and the persons name is not in the
>> list, the NotInList code is not triggered. If I type the same name
>> into the txt_Senior box the NotInList code is triggered. Why is it
>> that when the name is pushed in the code does not work but when I type
>> the same name into the txt_Senior box the NotInList code is triggered?
>>
>>
>I'm not sure why this is true but by design many form events are only
>triggered by user interactions. Seemingly parallel actions carried out
>in code don't trigger the events.
>
>I've not needed to deal with the specific issue you've asked about, but
>you should be able to work around it by testing the list in code for a
>match, and if a match is not found, fire the not in list event.


It is not necessary to search the list for a match. The
ListIndex property will be -1 if the the value is not in the
list.

--
Marsh
MVP [MS Access]

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net