Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / February 2006

Tip: Looking for answers? Try searching our database.

Code to check if form is open

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Eagle - 14 Feb 2006 19:40 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.