Reputation: 756
I have 2 columns, registered, and overall. The text in the overall column is determined by testing out the other column.
I have this in the table property validation rule.
iif([registered] = false, [overall] = "T", [overall] = "F")
When i run this the overall column is still empty, I have to enter the correct text (T or F) manually. It there a way to automatically fill in the column?
Upvotes: 1
Views: 52
Reputation: 97101
A Validation Rule defines what data values can be stored. However, a Validation Rule can not alter the values which are stored. So you need something else.
Based on your description, I'm unsure why [overall]
must be a table field. You could make it a field expression in a query instead.
SELECT
registered,
IIf([registered] = False, "T", "F") AS overall
FROM YourTable;
Use the query anywhere you need to see [overall]
.
If you need [overall]
to be an actual table field, and if your Access version is >= 2010 and if you can use the ACCDB database format, [overall]
could be a calculated field. However, that would mean your database could only be used by Access >=2010, or from other applications using a suitable version of the ACE driver.
Upvotes: 2
Reputation: 3874
Set de datasource for overall field as:
=iif([registered] = false, "T", "F")
If you need to store the overall field in database. Handle the AfterUpdate event for Registered:
Sub Registered_AfterUpdate()
Me.Overall = Iif([registered] = false, "T", "F")
End Sub
Upvotes: 0