vendredi 5 mai 2017

MS Access - SetFocus on multiple text boxes to check if data exists via SQL

The problem I'm facing:

I try to check if inserted text from multiple text boxes is already existing in a table before saving the records to avoid duplicates.

I created a form to enter new members and save them into a table. The key to avoid duplicates is to check the combination of given name, last name and birth date with existing records. (It's most likely that there won't be two person with all three criteria matching)

I have no problem to check the existence for only one text box by setting the focus on the desired box and use the SQL query IF EXISTS...

But since I would need to set focus on several text boxes(IMO) the problem occurs. Is there a way to set focus on multiple text boxes?

The idea would be to use an IF EXISTS...AND EXISTS statement and I would need to implement the .SetFocus statement for each text box before checking its existence.

I hope you get my point and I would be glad if someone could share some knowledge. :)

Thanks in advance

Aucun commentaire:

Enregistrer un commentaire