Full Version: How Do I UNDO and If Statement
UtterAccess Forums > Microsoft® Access > Access Forms
redwinger354
So I have an If statement like this:
If True Then
do A
Else
do B
End If
This runs at Form_Load and in other events.
I want to then reverse this in an OnClick event. Ultimatly Undo the changes.
If True Then
do B
Else
do A
End If
Ideas?
Thanks
RNeal
Well, since it runs in multiple places, create a common procedure and only have the code in there. Then, create a module/form-level variable (say "CurrBoolValue" As Boolean).
Private Sub MyCommonProc
CurrBoolValue = Not(CurrBoolValue)
If CurrBoolValue = True then
else
end if
End Sub
This way, each time the proc is called, the T/F variable is switched and the reverse logic is ran on every call.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.