Interesting combo observation

  • Thread starter Thread starter nanik
  • Start date Start date
N

nanik

Hi

I tried the following sample code from Microsof
(http://support.microsoft.com/default.aspx?scid=kb;en-us;161007) an
I notice that when I change the customer's name to somethin
different than what I previously entered in the combobox it give
error as if the data is not there.

For example enter 'Testing' in the customer name and press ENTER o
move away from the control it will asked do you want to add it ? the
select Yes after the customer's form is open try entering somethin
different than 'Testing' and then close the form. You will get a
error 'Please try again!' and the customer that you just entered i
not available in the combo box

Anybody knows how to work this problem around ? or are there an
solution to this kind of problem

Thank
 
nanik said:
I tried the following sample code from Microsoft
(http://support.microsoft.com/default.aspx?scid=kb;en-us;161007) and
I notice that when I change the customer's name to something
different than what I previously entered in the combobox it gives
error as if the data is not there.

For example enter 'Testing' in the customer name and press ENTER or
move away from the control it will asked do you want to add it ? then
select Yes after the customer's form is open try entering something
different than 'Testing' and then close the form. You will get an
error 'Please try again!' and the customer that you just entered is
not available in the combo box.

Anybody knows how to work this problem around ? or are there any
solution to this kind of problem ?


It's not really a problem. Think about it, you enter a name
in the combo, it's not in the list so you add a different
name. Now, the combo box still has the original name, which
is still not in the (modified) list, so it's no surprise
that it tells you it's not there.

If you want to change what you entered into the combo box to
be the same thing as what you added to the list, then you
can change the combo box's .Text property to the name you
added to the list. The complication with this seemingly
simple idea is that changing the como box's text property
will trigger the NotInList procedure a second time (because
the list has yet to be requeried).

I googled the newsgroups archives and found an example of a
NotInList event procedure that does this:
http://groups-beta.google.com/group...976142?q=NotInList+different#94241cb4d5976142
 
Hi Marshall

I implement the code outlined in the link you provided and it work
perfectly. Looks like the way the ComboBox NotInList event works a
follows

- Enter NOT IN LIST dat
- Open form enter the data (this time the data is different then type
in the combo
- Save the data in the form and close the for
- Access goes through the NotInList event again and because this tim
the name entered is different then the one we entered in combo i
gives error, so to avoid this a flag is checked to make sure tha
when the 2nd time the NotInList is being called it just retur
acDataErrContinue and exit the sub

The solution is pretty simple but it works like a charm :lol: :lol:
:lol
 
Back
Top