If statments (1 Viewer)

cktcPeterson

Member
Local time
Today, 05:55
Joined
Mar 23, 2022
Messages
73
I have a field [Remaining]

I would like to do a macro where when [Remaining]=0, [Status], "Funds Exhausted"

Or do I do a condional format?
 

CJ_London

Super Moderator
Staff member
Local time
Today, 14:55
Joined
Feb 19, 2013
Messages
16,641
depends where you are doing this. if a control on a form or in a query you just do a calculation, no macro required

iif([Remaining]=0, [Status], "Funds Exhausted")

where in a query Remaining and Status are the names of the fields, or in a form or report, then the name of the controls

conditional formatting is about colours and fonts, not content
 

cktcPeterson

Member
Local time
Today, 05:55
Joined
Mar 23, 2022
Messages
73
I want this to run as an after update.

So once I add in my amounts, once the remaining is 0, then the status field switches to "Funds Exhausted"
 

CJ_London

Super Moderator
Staff member
Local time
Today, 14:55
Joined
Feb 19, 2013
Messages
16,641
you are very vague about the requirement, but if you are running it in an event the code would be something like

if Remaining=0 then somefield= Status else somefield= "Funds Exhausted"

however I have no idea what you really mean - if this is intended to modify the record just entered, then after update is too late, it's already been updated.

think you need to explain very clearly what you are trying to do
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:55
Joined
May 7, 2009
Messages
19,246
I would like to do a macro where when [Remaining]=0, [Status], "Funds Exhausted"
you can save some space by Removing Status field.
use query to show the status:

select yourTable.*, IIF([Remaining] < 1, "Funds Exhausted", Null) As Status from yourTable;
 

Users who are viewing this thread

Top Bottom