user3510431
user3510431

Reputation: 55

Access prohibit the entry two spaces in field

In MS Access, how can I prohibit the entry of two spaces in the field in the table? Is it possible directly in the table or by using a form?

Example: John__Smith

Upvotes: 0

Views: 74

Answers (2)

HansUp
HansUp

Reputation: 97101

You can enforce that requirement in your table's design with a Validation Rule for the field:

field Validation Rule

Note I used ALike which tells the db engine to treat % as a wildcard to match zero or more of any characters. If you prefer Like, use this for the Validation Rule property: Not Like '* *'

Upvotes: 2

Rdster
Rdster

Reputation: 1872

Sounds like something that you need to handle on a data entry form.

You can use the AfterUpdate event for the control and write code to check for 2 spaces in a row, and then remove one.

Upvotes: 2

Related Questions