Hello, all.
I think I already know the answer, but I really want someone to tell me I'm wrong
Here is my issue. I've placed a command button on an insanely complicated form named View Orders. The command button, which we'll call CmdClearFlag for our purposes, clears (hides) a warning flag which pops up on said form when certain conditions are met.
Because this form is already really busy, I'd like that button to be invisible unless the warning flag is flying.
I've figured out that I need to put the code in the form's On Current event, and I know to show or hide the button. Here's the complicated part:
The condition that throws the warning flag is whether a field in a given order in the table Orders is set to TRUE or FALSE (True = Flag). The primary key for the Orders table is OrderNumber, and let's call the flag-throwing column Warning.
I think what I want to do is compare the Order Number displayed in the View Orders textbox TxtOrder to the OrderNumber column in the Orders table, and then check to see whether the Warning field in that same row has a -1 in it.
This is what I've sketched out on the back of my napkin:
Of course, the whole thing depends on whether or not I can use the WHERE in an IF-THEN environment. Since there is already a small novella's worth of code in the form's On Current event, I don't want to risk putting something new in there without consultation.
As always, your advice will be appreciated.
I think I already know the answer, but I really want someone to tell me I'm wrong
Here is my issue. I've placed a command button on an insanely complicated form named View Orders. The command button, which we'll call CmdClearFlag for our purposes, clears (hides) a warning flag which pops up on said form when certain conditions are met.
Because this form is already really busy, I'd like that button to be invisible unless the warning flag is flying.
I've figured out that I need to put the code in the form's On Current event, and I know to show or hide the button. Here's the complicated part:
The condition that throws the warning flag is whether a field in a given order in the table Orders is set to TRUE or FALSE (True = Flag). The primary key for the Orders table is OrderNumber, and let's call the flag-throwing column Warning.
I think what I want to do is compare the Order Number displayed in the View Orders textbox TxtOrder to the OrderNumber column in the Orders table, and then check to see whether the Warning field in that same row has a -1 in it.
This is what I've sketched out on the back of my napkin:
Code:
IF [tables].[orders].[warning] = "-1" WHERE [tables].[orders].[OrderNumber] = [forms].[View Orders].[TxtOrder] THEN
me.CmdClearFlag.visible = True
Else
me.CmdClearFlag.visible = False
As always, your advice will be appreciated.