1 (edited by ktommy 2022-08-26 21:27:57)

Topic: Preventing from entering duplicate record

Hello everyone once again,

This time I have a real nightmare. I tried to finally start with my final project but there's a huge gap that needs to be filled. Since we have machines with unique serial numbers that contains numbers and letters, I want to prevent being duplicating while saving the record. But so far I couldn't achieve it.
I found numerous articles and samples and tried to customize the codes and scripts to my project but still nothing.
One that somehow worked is that Derek put on the Duplicate sample, until I close the project and reopen it and then idk something went wrong and it's not working again. It stores the serial number as 0 when serial number contains letters but with numeric is working fine.
I send a sample, any help really appreciated.

Post's attachments

Attachment icon duplicates_.zip 337.14 kb, 115 downloads since 2022-08-26 

Re: Preventing from entering duplicate record

Sorry My bad I didn't saw that the serialnumber was a real and not text.
I have no excuse sad

Re: Preventing from entering duplicate record

Hi,
Another option (possibly better) is to use the 'cancel' option on the 'save' button.
Also you might try 'messagebox' instead of 'showmessage' as it lets you customise the message caption so you can make your messages more focused and user-friendly.
Derek.

Post's attachments

Attachment icon duplicates_test2.zip 337.17 kb, 161 downloads since 2022-08-27 

Re: Preventing from entering duplicate record

Hello Derek,

Oh I see. Yes, you're right is much better option. Thank you for providing me this concept. I'll make sure to put it in good use big_smile
Still have much to learn.

Enjoy the weekend,
Tommy.