Column Validation

R

Ron

Hi,

I have a column which has a yes/no type field. Is it possible to perform
some validation so that only one entry in the column can be set to 'yes'?

Regards,
Ron.
 
D

Douglas J. Steele

Assuming you're updating through a form, yes: you can put logic in the
form's BeforeUpdate event along the lines of:

If DCount("*", "MyTable", "MyField Is True") > 1 Then
MsgBox "Too many checked"
Cancel = True
End If

If you're wanting this on the table itself, no, it's not possible.
 
T

Tim Ferguson

I have a column which has a yes/no type field. Is it possible to perform
some validation so that only one entry in the column can be set to 'yes'?

This sounds like a design problem. Shouldn't there be just one value
pointing to the "yes" record..? Could be a value in another table, a
database property, a control value or something.

Just a thought


Tim F
 
P

Pat Hartman\(MVP\)

Sounds like you have a mutually exclusive value. For example, you have
colors - blue, red, green. Only one is valid. You would use one attribute
rather than three to hold the information. You can use a combo to select
the choice or if you have only a couple of options, you can use an option
group. The option group will need to store a numeric value so whenever you
need to display the chosen value, you need to use a combo or some code to
convert the numeric value to text.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top