Sposobów jest kilka.
Function CheckOtherInstances() As Boolean' sprawdza, czy w systemie aktywne sa inne instancje biezacej bazyDim chan As Long Application.SetOption "Ignore DDE Requests", True'żeby nie gadało samo ze sobąOn Error GoTo CheckOtherInstances_NoInstance chan = DDEInitiate("MSAccess", "<tu nazwa pliku bazy danych - bez .MDB na końcu>") DDETerminate chan CheckOtherInstances = True GoTo CheckOtherInstances_End CheckOtherInstances_NoInstance: CheckOtherInstances = False CheckOtherInstances_End: Application.SetOption "Ignore DDE Requests", False End Function
' Access 97 (NIE UŻYWAĆ W WYŻSZYCH WERSJACH)If hWndAccessApp <> GetObject(CurrentDb.Name).hWndAccessApp Then MsgBox "Baza juz otwarta w innej instancji Accessa" DoCmd.Quit End If
Set rs = cn.OpenSchema(adSchemaProviderSpecific, , _ "{947bb102-5d43-11d1-bdbf-00c04fb92675}")' Output the list of all users in the current database.Debug.Print rs.Fields(0).Name, "", rs.Fields(1).Name, _ "", rs.Fields(2).Name, rs.Fields(3).Name