Finding if string is in list without NotInList event

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

Hello again.
When the user double clicks the combobox they are given the option if they
want to add the details. I would like to check if the string already exists
in the combobox to prevent duplicate entries.
When the user clicks yes (to add bank details) Check the combobox to see if
the string exists and tell the user that it already exists.
 
That's what NotInList does so why would you not want to use it?

Brett

Hello again.
When the user double clicks the combobox they are given the option if they
want to add the details. I would like to check if the string already exists
in the combobox to prevent duplicate entries.
When the user clicks yes (to add bank details) Check the combobox to see if
the string exists and tell the user that it already exists.

Cheers,
Brett
 
Using the NotInList event to open a different form was too complicated for
me. By using the NotInList to advise users to double click the combobox was
alot easier to code. From within the doubleClick event I would like to
refer to NotInList using code.
 
Using the NotInList event to open a different form was too complicated for
me.

Oh well, we can help with that. In the NotInList Event Procedure
simply put this line of code

DoCmd.OpenForm "MyFormsName"

Try that and let us know if that's what you wanted to do.'

Brett

By using the NotInList to advise users to double click the combobox was
alot easier to code. From within the doubleClick event I would like to
refer to NotInList using code.
Brett Collings said:
That's what NotInList does so why would you not want to use it?

Brett



Cheers,
Brett

Cheers,
Brett
 
I couldn't do that because the code was running through to the error message
"Not in list". When opening it with the acDialog the code stopped and I
couldn't pass the code over. I tried using the OpenArgs but it was just too
complicated. After searching many news groups I decided it would be easier
to use the double click event.
Brett Collings said:
Using the NotInList event to open a different form was too complicated for
me.

Oh well, we can help with that. In the NotInList Event Procedure
simply put this line of code

DoCmd.OpenForm "MyFormsName"

Try that and let us know if that's what you wanted to do.'

Brett
 
Public Function IsInList(ByVal NewValue As String) As Boolean

IsInList = Not IsNull(DLookup("TheText", "TheTable", "TheText='" &
NewValue & "'"))

End Function

Where 'TheText' is the name of the field and 'TheTable' is the name of the
table that supply the rowsource of the combo box, and 'NewValue' is the the
text that may or may not be already in that table.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


Chris said:
I couldn't do that because the code was running through to the error
message
"Not in list". When opening it with the acDialog the code stopped and I
couldn't pass the code over. I tried using the OpenArgs but it was just
too
complicated. After searching many news groups I decided it would be
easier
to use the double click event.
 
Back
Top