unique value in a control?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all

im trying to make a form that has records in a datasheet which have combo
boxes within each record. The combo box has only 5 values just in a list not
looked up from any otehr source eg) A,B,C,D,E. What i want is for the system
to allow infinite records with A,B,C,D but only one record to be allowed to
have value E.

ps. not great with VB but will give it a try

cheers

Si
 
Hi all

im trying to make a form that has records in a datasheet which have combo
boxes within each record. The combo box has only 5 values just in a list not
looked up from any otehr source eg) A,B,C,D,E. What i want is for the system
to allow infinite records with A,B,C,D but only one record to be allowed to
have value E.

ps. not great with VB but will give it a try

cheers

Si

Code the BeforeUpdate event of the combo Box:

If Me!ComboName = "E" then
If DCount("*","TableName","[FieldName] = 'E'")>0 then
MsgBox "This value already exists"
Cancel = True
End If
End If
 
Worked great! cheers

Si

fredg said:
Hi all

im trying to make a form that has records in a datasheet which have combo
boxes within each record. The combo box has only 5 values just in a list not
looked up from any otehr source eg) A,B,C,D,E. What i want is for the system
to allow infinite records with A,B,C,D but only one record to be allowed to
have value E.

ps. not great with VB but will give it a try

cheers

Si

Code the BeforeUpdate event of the combo Box:

If Me!ComboName = "E" then
If DCount("*","TableName","[FieldName] = 'E'")>0 then
MsgBox "This value already exists"
Cancel = True
End If
End If
 
Back
Top