Valid_if checks also if updating an entry but...

(Pim Sauter) #1

Valid_if checks also if updating an entry but not that specific field

I have an app, where I create orders, and assign an agent to that order, by means of a Ref to a table agents. Each agent has a field ‘is_active’, which determines of the agent is currently employed or not. When an agent gets added to an order, the app checks with Valid_if if the agent is active:

[agent_id].[is_active] = TRUE

Now, an inactive agent can still exist on old orders, which is useful for record keeping. When I go into one of these orders, and edit another field like ‘order_status’, and click ‘Save’, the Valid_if will throw an error, because the agent has is_active = FALSE.

However, I did not touch the agent field in this edit, so I would also expect not to get this error. Is there a way around this?

(Aleksi Alkio) #2

You need to bind that validation to somewhere else, like IF([Status]=“Old”,TRUE,[agent_id].[is_active])