J
jrmfzf
I've created a function that first checks to make sure if a form is
open and then if the form is open returns the value of an option group
on the form. The function is run in a crosstab query which uses the
returned value to filter. However, when the function is run I get a
runtime error 2427, "You entered an expression that has no value" on
the arrowed line below:
Function BusOption() As Integer
Dim stDocName As String
stDocName = "VT_USAGE_FORM"
If IsLoaded(stDocName) = -1 Then 'Form is open
-> BusOption = Forms(stDocName)!BUS_SELECT 'Option group
Else
BusOption = 1 'Forms is closed
End If
End Function
I think the problem is that for some reason the IsLoaded function is
claiming that the form is open before it has actually been opened.
Here's that function:
Function IsLoaded(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
IsLoaded = True
End If
End If
End Function
Does anyone have any suggestion?
open and then if the form is open returns the value of an option group
on the form. The function is run in a crosstab query which uses the
returned value to filter. However, when the function is run I get a
runtime error 2427, "You entered an expression that has no value" on
the arrowed line below:
Function BusOption() As Integer
Dim stDocName As String
stDocName = "VT_USAGE_FORM"
If IsLoaded(stDocName) = -1 Then 'Form is open
-> BusOption = Forms(stDocName)!BUS_SELECT 'Option group
Else
BusOption = 1 'Forms is closed
End If
End Function
I think the problem is that for some reason the IsLoaded function is
claiming that the form is open before it has actually been opened.
Here's that function:
Function IsLoaded(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
IsLoaded = True
End If
End If
End Function
Does anyone have any suggestion?