How to find if a value exists in a table?

  • Thread starter Thread starter Amit
  • Start date Start date
A

Amit

Hi,

This must be really simple, but it's the end of the day,
and I'm just not getting it.

I would like to have the user input an organization name,
and then do a lookup in the organization table to see if
the name already exists.

I have created a parameter query with the organization
name as parameter, and Organization ID (PK) as the value
returned. If the Organization ID > 0, then the
Organization name exists, otherwise not. In the latter
case, the user can go ahead and add the new Organization
details. I created a form based on the parameter query,
and it shows the Organization ID if it exists.

Not sure how to proceed after this. Any pointers (general
outline steps and/or details) will be much appreciated.

Thanks, and have a wonderful weekend!

-Amit
 
well, speaking in generalities, i'd probably do this:
1. make the input box a combo box listing all the existing
organizations.
2. set the combo's NotInList event to open a msgbox
saying "Do you want to add the organization?", with Yes
and No buttons.
3. On Yes, open the form where the user can add the
organization to the underlying table.
4. On No, set the combo box's value to null and drop the
list (if entry is required in this control on the form).
 
Back
Top