Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to check is a MS Access frm is open from another Application

Status
Not open for further replies.

jac22

Technical User
Apr 10, 2007
1
DE
Hi All,
I'm looking to check if a MSAccess 2003 form is open from RSView32 (industrial Scada) VBA. If it is open I want to close or bring it forward so the operator does not open another instance. I can kill the app and this seem to work but there must be a better way. Just as a note I'm a PLC programmer and my VB skills are poor so please be gentle. Thanx

Here is how we are currently calling the form.

'Open Access Database to allow the operators to view the access database screens Reporting ONLY!
'******************************************************************************************
Public Sub Open_Reporting()
On Error Resume Next
'MsgBox "Test1"
Set AppAccess = GetObject(, "Access.Application")
On Error GoTo Open_Reporting_Err
Set AppAccess = GetObject("C:Access\System_Forms_Only.mdb", "Access.Application")
AppAccess.Application.Visible = True
'AppAccess.window(1).Visible = True

Exit Sub
Open_Reporting_Err:
MsgBox "Error in Open_Reporting" & Chr$(13) & Err.Description & " ," & Err.Number
Exit Sub
End Sub
 
The usual way to check for an open Access form is with:

result = SysCmd (GetObjectState, acForm, Formname)

Return values are:
0 - Form closed
1 - Form Open
2 - Form opened and changed but not saved
4 - Form new but not saved

However, I've not tried checking this value from another application.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top