1

How do make sure that the primary key has one "@" in the column "email" in MS Access database, so it does not save any data without one "@" and throw exception.

I also have one column that saves domain names and it should have one "."

How do I do this validation too?

Computer User
  • 2,839
  • 4
  • 47
  • 69

1 Answers1

4
  • Add the following "validation rule" to your field

    Like "*@*"
    
  • Add a "validation text" with a descriptive error message, e.g.

    E-mail address must contain at least one @
    

As a side note: I would strongly advise against using an e-mail address as a primary key. The primary key is used to create references between tables and should usually be a value that won't change. E-mail addresses, however, do change. You might want to consider using an AutoNumber field instead (a so-called "surrogate key" which has certain advantages).

Community
  • 1
  • 1
Heinzi
  • 167,459
  • 57
  • 363
  • 519
  • I also have one column that saves domain names and it should have one dot "." How do I do this validation too? – Computer User Jun 18 '13 at 15:53
  • Please can you look at this problem and let me know what I am missing. http://stackoverflow.com/questions/17213787/sql-executes-well-in-ms-access-but-not-in-c-sharp-when-validation-rule-is-set – Computer User Jun 20 '13 at 13:38