crisis2007
Technical User
I am trying to prevent records from being edited in a pop up form when a different form is also open. More specifically, I want to prevent editing of the records on a subform SF_Stat (embedded in a parent form F_EventDetails) when another form F_Activity is open.
I have the following in a module that I retrieved from the NorthWind sample:
Function IsLoaded (ByVal strFormName As String) As Boolean
Const conObjStateClosed = 0
Const conDesignView = 0
If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> _
conObjStateClosed Then
If Forms (strFormName).CurrentView <> consDesignView Then
IsLoaded = True
End If
End If
End Function
On the "On Current" event of SF_Stat I placed the following:
If IsLoaded("Forms![F_Activity]") = True Then
Me.AllowEdits = False
It seems to work in reverse - that is it does allow edits. However if I change the above code to say
If IsLoaded("Forms![F_Activity]") = False
it stops me from editing.
Am I not looking at this right? Should I just use another method? I have worked on this for several hours and it just is not working the way I want. I would leave it alone but it also messes up another form that I use when creating new records.
I have the following in a module that I retrieved from the NorthWind sample:
Function IsLoaded (ByVal strFormName As String) As Boolean
Const conObjStateClosed = 0
Const conDesignView = 0
If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> _
conObjStateClosed Then
If Forms (strFormName).CurrentView <> consDesignView Then
IsLoaded = True
End If
End If
End Function
On the "On Current" event of SF_Stat I placed the following:
If IsLoaded("Forms![F_Activity]") = True Then
Me.AllowEdits = False
It seems to work in reverse - that is it does allow edits. However if I change the above code to say
If IsLoaded("Forms![F_Activity]") = False
it stops me from editing.
Am I not looking at this right? Should I just use another method? I have worked on this for several hours and it just is not working the way I want. I would leave it alone but it also messes up another form that I use when creating new records.