Warning message when user accidently tries to enter same value in form, how?

adi2011

Registered User.
Local time
Today, 15:25
Joined
May 1, 2011
Messages
60
Hello,

I would like to prevent user, on new form I made, that when he enters same value more then once, with some warning message "You can't add same value again, please try again." For easy explanation I have made screenshot

05012013231235.jpg


I think I could create some code for "After update" event of combobox on screenshot but I don't know how so any suggestion is welcome.

Any help is appreciated and many thanks in advance for prompt replies!

Cheers;)
Adi
 
You could use the before update -- before the data actually tires to be written.

You could try

If DCount() >0 then msg
else
proceed
 
Check out DCount()

http://www.techonthenet.com/access/functions/domain/dcount.php

If you are in doubt about the use of functions, Google can often get you the details.

You may also check error 3022

Here's a sample from a module

Code:
If DCount("*", "ImportFileListHistory", "filename ='" & fl.name & "'") > 0 Then
MsgBox "File " & fl.name & " has been imported previously??  BYPassing  this import attempt!!!!"
 

Users who are viewing this thread

Back
Top Bottom