Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Acc97: SysCmd query

0 views
Skip to first unread message

pcdev

unread,
Feb 5, 1999, 3:00:00 AM2/5/99
to
Hi all,

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

Dev Ashish

unread,
Feb 5, 1999, 3:00:00 AM2/5/99
to
Hi Simon,

I'm unable to get that value. What steps surround this SysCmd call ??

-- Dev

pcdev wrote in message ...
:Hi all,

:
:

Terry Kreft

unread,
Feb 6, 1999, 3:00:00 AM2/6/99
to
acObjStateOpen = 1
acObjStateDirty = 2
acObjStateNew = 4

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

0 new messages