Hi everyone,
I have a very long If statement which i have realised only applies the "AND" to the last "OR" I have entered.
Basically i have a dropdown box and once the record is complete, depending on the "Move_Reason" certain fields can or cannot have certain data in them.
Some "Move_Reason" have the same requirements
I'm sure there is a way without me having to write each individual condition down for each "Move_Reason"
Im sure i've explained it badly, here is a snippet of x4 "Move_Reason" that should follow the same rules but it only works on "Disassembly"
I understand the OR AND is the reason why disassembly is the only one working properly but it looks like such a long way to have every move reason have an OR AND ?
I have a very long If statement which i have realised only applies the "AND" to the last "OR" I have entered.
Basically i have a dropdown box and once the record is complete, depending on the "Move_Reason" certain fields can or cannot have certain data in them.
Some "Move_Reason" have the same requirements
I'm sure there is a way without me having to write each individual condition down for each "Move_Reason"
Im sure i've explained it badly, here is a snippet of x4 "Move_Reason" that should follow the same rules but it only works on "Disassembly"
I understand the OR AND is the reason why disassembly is the only one working properly but it looks like such a long way to have every move reason have an OR AND ?
Code:
If Me.Move_Reason = "Order" Or Me.Move_Reason = "Repair" Or Me.Move_Reason = "ForParts" Or Me.Move_Reason = "Disassembly" And Me.[+/-] = "+" Or _
Me.Move_Reason = "Order" Or Me.Move_Reason = "Repair" Or Me.Move_Reason = "ForParts" Or Me.Move_Reason = "Disassembly" And IsNull(Me.From_Location) Or _
Me.Move_Reason = "Order" Or Me.Move_Reason = "Repair" Or Me.Move_Reason = "ForParts" Or Me.Move_Reason = "Disassembly" And Me.From_Location = "" Or _
Me.Move_Reason = "Order" Or Me.Move_Reason = "Repair" Or Me.Move_Reason = "ForParts" Or Me.Move_Reason = "Disassembly" And IsNull(Me.Ref) Or _
Me.Move_Reason = "Order" Or Me.Move_Reason = "Repair" Or Me.Move_Reason = "ForParts" Or Me.Move_Reason = "Disassembly" And Not IsNull(Me.To_Location) Or _
Me.Move_Reason = "Order" Or Me.Move_Reason = "Repair" Or Me.Move_Reason = "ForParts" Or Me.Move_Reason = "Disassembly" And Me.To_Location <> "" Or _
Me.Move_Reason = "Order" Or Me.Move_Reason = "Repair" Or Me.Move_Reason = "ForParts" Or Me.Move_Reason = "Disassembly" And Me.Ref = "" Then
MsgBox "ERROR! Please check, At least one field is incorrect"
DoCmd.CancelEvent
Last edited: