E
Eric
Hi guys,
Can someone help me here? I'm having a really hard time
with this fIsLoaded Function. I have passed this on to the
IsLoaded Function, but I want the fIsloaded to fall back
on my original Forms Class module to see if a form is open
or not. What am I doing wrong????? Here's my code.
In the Forms Class Module:
Private Sub Form_Open(Cancel As Integer)
Dim UserID As Long, ACode As Integer, strFormName As String
strFormName = "frmAnalysisFilm"
UserID = Forms!frmPassword!cboEmployee
ACode = DLookup("AccessLevelID", "tblUser", "ID = " &
UserID)
Me.Mach.Enabled = False
Me.Product.Enabled = False
Me.Date_Scrapped.Enabled = False
Me.DateProduced.Enabled = False
Me.Reason.Enabled = False
Me.Operator.Enabled = False
Me.PoundsScrapped.Enabled = False
Me.Skid.Enabled = False
Me.Roll.Enabled = False
Me.ScrappedBy.Enabled = False
If ACode < 1 Then
Me.Command20.Enabled = False
Me.Command21.Enabled = False
Me.Command22.Enabled = False
Me.Command24.Enabled = False
Exit Sub
Else: End If
Call fIsLoaded(strFormName)
If fIsLoaded = -1 Then
Me.Mach.Enabled = True
Me.Product.Enabled = True
Me.Date_Scrapped.Enabled = True
Me.DateProduced.Enabled = True
Me.Reason.Enabled = True
Me.Operator.Enabled = True
Me.PoundsScrapped.Enabled = True
Me.Skid.Enabled = True
Me.Roll.Enabled = True
Me.ScrappedBy.Enabled = True
Me.Command23.Enabled = False
Else: End If
DoCmd.Maximize
End Sub
Here's in a normal module:
Function fIsLoaded(ByVal strFormName As String) As Integer
'Returns a 0 if form is not open or a -1 if Open
If SysCmd(acSysCmdGetObjectState, acForm, strFormName)
<> 0 Then
If Forms(strFormName).CurrentView <> 0 Then
fIsLoaded = True
End If
End If
End Function
Can someone help me here? I'm having a really hard time
with this fIsLoaded Function. I have passed this on to the
IsLoaded Function, but I want the fIsloaded to fall back
on my original Forms Class module to see if a form is open
or not. What am I doing wrong????? Here's my code.
In the Forms Class Module:
Private Sub Form_Open(Cancel As Integer)
Dim UserID As Long, ACode As Integer, strFormName As String
strFormName = "frmAnalysisFilm"
UserID = Forms!frmPassword!cboEmployee
ACode = DLookup("AccessLevelID", "tblUser", "ID = " &
UserID)
Me.Mach.Enabled = False
Me.Product.Enabled = False
Me.Date_Scrapped.Enabled = False
Me.DateProduced.Enabled = False
Me.Reason.Enabled = False
Me.Operator.Enabled = False
Me.PoundsScrapped.Enabled = False
Me.Skid.Enabled = False
Me.Roll.Enabled = False
Me.ScrappedBy.Enabled = False
If ACode < 1 Then
Me.Command20.Enabled = False
Me.Command21.Enabled = False
Me.Command22.Enabled = False
Me.Command24.Enabled = False
Exit Sub
Else: End If
Call fIsLoaded(strFormName)
If fIsLoaded = -1 Then
Me.Mach.Enabled = True
Me.Product.Enabled = True
Me.Date_Scrapped.Enabled = True
Me.DateProduced.Enabled = True
Me.Reason.Enabled = True
Me.Operator.Enabled = True
Me.PoundsScrapped.Enabled = True
Me.Skid.Enabled = True
Me.Roll.Enabled = True
Me.ScrappedBy.Enabled = True
Me.Command23.Enabled = False
Else: End If
DoCmd.Maximize
End Sub
Here's in a normal module:
Function fIsLoaded(ByVal strFormName As String) As Integer
'Returns a 0 if form is not open or a -1 if Open
If SysCmd(acSysCmdGetObjectState, acForm, strFormName)
<> 0 Then
If Forms(strFormName).CurrentView <> 0 Then
fIsLoaded = True
End If
End If
End Function