Hopefully simple!

  • Thread starter Thread starter Pemo
  • Start date Start date
P

Pemo

In Access 2k, an entry is to be evaluated, with multiple valid entries. How
would this be expressed?

For example, a keyboard entry can be George Washington or G. Washington or G
Washington or Washington - any of those is a valid entry (case insensitive),
resulting in a certain action. All others are not, and result in a
different action.

Any pointers? I have a mental block (also known as a senior moment :-) )

TIA

Pemo
 
Make a 1-many relationship between the questions(?) and
valid answers?

QuestionID
QText

QuestionID
ValidAnswerID

ValidAnswers
ValidAnswerID
VAText

ValidAnswerID 1: VAText: George Washington
ValidAnswerID 2: VAText: Washington George
ValidAnswerID 3: VAText: G Washington
ValidAnswerID 4: VAText: Washington
ValidAnswerID 5: VAText: G. Washington
ValidAnswerID 6: VAText: Washington G.

A bit cumbersome to put in all valid entries.
Perhaps you can also trim out any spaces in your equation
so that George Washington=George Washington
 
Pemo said:
In Access 2k, an entry is to be evaluated, with multiple valid entries. How
would this be expressed?

For example, a keyboard entry can be George Washington or G. Washington or G
Washington or Washington - any of those is a valid entry (case insensitive),
resulting in a certain action. All others are not, and result in a
different action.

Any pointers? I have a mental block (also known as a senior moment
:-) )

Several ways to do this. Basic Validation in code would be to use the
BeforeUpdate event.

Select Case Me.TextBox
Case "valid entry 1", "valid entry 2", etc...
'do nothing - validation passed.
Case Else
MsgBox "Invalid Entry"
Cancel = True
End Select

You could also provide a ComboBox with LimitToList = True and have all the
correct entries as choices. When this list is big enough or subject to
change it would be best stored in a lookup table.
 
Rick Brandt said:
Several ways to do this. Basic Validation in code would be to use the
BeforeUpdate event.

Select Case Me.TextBox
Case "valid entry 1", "valid entry 2", etc...
'do nothing - validation passed.
Case Else
MsgBox "Invalid Entry"
Cancel = True
End Select

You could also provide a ComboBox with LimitToList = True and have all the
correct entries as choices. When this list is big enough or subject to
change it would be best stored in a lookup table.

Thanks! Will try both suggestions.

Pemo
 
Back
Top