|
-
Mar 22nd, 2000, 09:43 PM
#1
Thread Starter
Junior Member
Hi
How can I quickly detect whether the data entered into the TextboxA will cause a duplicate in the database as soon as it losts focus?
I'd set the referencial integrity in the database but the referencial
integrity just take place when I'd completed all the fields and trying to
save the record. I want to have an immediate validation as well as the focus is shifted over to other controls. Should I use the Findfirst method to check duplicate on the textboxA_validate(keepfocus....) procedure ?
-
Mar 22nd, 2000, 09:55 PM
#2
Lively Member
You can do a couple of things.
1. You can write a Stored Procedure to return the record with the key that was entered in the textbox. If .EOF=True then the key does not exsist.
2. You could load all the keys into an array and search the array for the value entered to see if it exsists. The array could be a combobox if you want to be able to choose one of the keys.
3. You could use the FindFirst as you stated.
Part of your soultion will depend on if multiple users will be accessing the database at the same time. If this is the case then you may want to use the stored procedure in the Text1_Validate event and also check it again before the data is saved.
I hope this helps.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|