Hi,
I've got an input form (frmInput) that can be accessed in two ways.
A combobox on this form either gets filled in by a selection on an already
opened form (frmBasic), or one can input a value manually after opening the
frmInput directly.
Is there a way in VBA I can detect if the frmInput is opened based on a
selection on frmBasic or if the frmInput is opened as stand alone?
I suppose something in the onload event of frmInput that checks IF frmBasic
is open THEN the combobox has a value based on a field in the open frmBasic
ELSE the combobox is NULL.
No idea what the code would look like in this case.
All help is welcome.
Thx.
Deano - 14 Feb 2006 20:22 GMT
> Hi,
>
[quoted text clipped - 11 lines]
>
> Thx.
To detect if frmBasic is open you could use this function;
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
Then call it like this;
If fIsLoaded("frmBasic") = True Then
'whatever code you like
End if
Eagle - 14 Feb 2006 20:28 GMT
> To detect if frmBasic is open you could use this function;
>
[quoted text clipped - 12 lines]
> 'whatever code you like
> End if
Thanks Deano!
Will give it a go and will get back to you if this does the trick.
Lyle Fairfield - 14 Feb 2006 23:59 GMT
CurrentProject.AllForms("frmBasic").IsLoaded