C
Crystal via AccessMonster.com
I am new to vba and I am learning to create functions. I copied this function
from MSDN. Would someone be kind enough to explain to me:
Why variable Globalflag is needed to be declared in this function?
What does “GlobalFlag = x” do at the end?
Why does this function works fine the first time it is used but afterwards
the very first record would be marked incorrectly? (1*, 2,3,5*. Should be 1,2,
3,5*)
Eager to hear from any of you experts. Appreciate it. See function code below:
Option Compare Database
Dim GlobalFlag As Variant
Public Function SetFlag(x As Variant)
If GlobalFlag <> x - 1 Then
SetFlag = "*"
Else
SetFlag = " "
End If
GlobalFlag = x
End Function
from MSDN. Would someone be kind enough to explain to me:
Why variable Globalflag is needed to be declared in this function?
What does “GlobalFlag = x” do at the end?
Why does this function works fine the first time it is used but afterwards
the very first record would be marked incorrectly? (1*, 2,3,5*. Should be 1,2,
3,5*)
Eager to hear from any of you experts. Appreciate it. See function code below:
Option Compare Database
Dim GlobalFlag As Variant
Public Function SetFlag(x As Variant)
If GlobalFlag <> x - 1 Then
SetFlag = "*"
Else
SetFlag = " "
End If
GlobalFlag = x
End Function