SysCmd(acSysCmdGetObjectState, acReport, [MyReportName]) returns a 3.
Anyone know what a 3 is in this context? (the documented states appear to
be dirty, open and new).
Thanks and regards
Simon....@Bristol-West.Co.Uk
PC Development
I'm unable to get that value. What steps surround this SysCmd call ??
-- Dev
pcdev wrote in message ...
:Hi all,
:
:
So if you get a 3 from
SysCmd(acSysCmdGetObjectState, acReport, [MyReportName])
Then MyReportName is open (acObjStateOpen) and it is dirty
(acObjStateDirty), that is it has been changed but not saved.
If you had a new report ("Report1") which hadn't been saved then
SysCmd(acSysCmdGetObjectState, acReport, "report1")
would return 5 (acObjStateOpen + acObjStateNew). If you then added a
textbox to it, you would get 7 (acObjStateOpen + acObjStateDirty +
acObjStateNew)
In other words you get a bitmask back from which you can extract the exact
state of the object.
So you could do something like this
Function ObjectState(ObjectName As String, ObjectType As Integer) As Integer
Dim intRet As Integer
Select Case ObjectType
Case acTable To acModule '0 to 5
intRet = SysCmd(acSysCmdGetObjectState, ObjectType, ObjectName)
If (intRet And acObjStateOpen) = acObjStateOpen Then _
MsgBox ObjectName & " is Open"
If (intRet And acObjStateDirty) = acObjStateDirty Then _
MsgBox ObjectName & " has been changed and isn't saved"
If (intRet And acObjStateNew) = acObjStateNew Then _
MsgBox ObjectName & " is New"
If intRet = 0 Then _
MsgBox ObjectName & " is closed or doesn't exist"
Case Else
MsgBox "Supply a valid Object Type"
intRet = -1
End Select
ObjectState = intRet
End Function