NotInList function within VB?

Jackpotgee

Registered User.
Local time
Today, 16:30
Joined
Jun 7, 2007
Messages
27
Hi,

I have a combo box that selects its values based on a query. This Combo box displays a list of companies for selection. It is possible that the user can enter a company that is not in the List.

I have a seperate button to add the company to the list, if and when the user decides to. However i want to stop the the user adding a company name to the list if it already exists.

Hope this makes sense so far....

What i am trying is

If (the new value currently typed in the combo box is already in the list) Then exitcode Else performfunction.


Any ideas or help anyone?
 
I assume you have a seperate form to enter the company info? if so write a procedure to open up the form if the user enters a value that is not in the list.
 
Cheers for the quick response.

I do have a seperate form to enter the details of the new company. However i do not always want the new company to be added to the list. Only when the user selects to do so by clicking on a button next to the combo.

It is on this button click that i want to check if the value that is currently typed in the combo box, is in fact already in the list. If it is then i want to break from the code instead of creating duplicate entry in the list.
 
So what have you tried and why does it not give you what you want?
 
You could use DCount() to count the number of times that value exists in the dataset. If it is zero, allow the addition, if it is any other value, don't.
 

Users who are viewing this thread

Back
Top Bottom