Basic search based on 3 fields

ciapul12

New member
Local time
Today, 20:43
Joined
Jul 30, 2014
Messages
5
Hello
I'm trying figure out the basic search function based on 3 fields in my form.
The form I'm referring to is called "Prodlive1". This form is used to stream the information to my table called "Prodlive". This form is used by multiple people so I want to prevent them from creating the records that already exist in table.
There are 3 main fields in Prodlive table that contain the information which will help to determine whether or not that record already exists.
Those fields are as follows:
-Variety
-Pack Type
-Grower
If the same information already exist in those one of the records then I would like a message to appear.

I have attached sample database with fake info so that you can take a look as it's hard to explain this in writing.

If someone creates a record they have to click "Save and add new record" button on "Prodlive1" form, this is where I need an information/warning to be displayed and option for user to either cancel,keep existing record or OK to import new record to table.

Please let me know how I can do that..

Regards
Dan
 

Attachments

One way to stop the combination from happening is to create a UNIQUE index with those three fields named. What you could do is in that button-click event (where you do the save), have a trap handler that looks for the "Duplicate Record" error when you try to do the "Save Record" operation. If the trap isn't for a "key-violation, duplicate record" case, you handle it one way, but if it IS, you can pop up a message box (perhaps using the "OK Only" option) and do a "RESUME" to a specific label in that routine to cause the "Save" attempt to simply be dismissed.
 

Users who are viewing this thread

Back
Top Bottom