Salve a tutti...
Io ho un programma che interagisce con un DB access sia con ADO che con oggetti di tipo Data..
Ora io dal programma richiamo un report di access con il seguente codice:
con questa funzione e possibile sia aprire una anteprima del report prima di stamparla oppure aprire il report per modificarne la struttura..codice:Public Function fOpenRemoteReport(strMDB As String, strReport As String, Optional intView As Variant) As Boolean Dim objAccess As Access.Application Dim lngRet As Long On Error GoTo fOpenRemoteReport_Err If IsMissing(intView) Then intView = acViewPreview If Len(Dir(strMDB)) > 0 Then Set objAccess = New Access.Application With objAccess lngRet = apiSetForegroundWindow(.hWndAccessApp) lngRet = apiShowWindow(.hWndAccessApp, SW_NORMAL) lngRet = apiShowWindow(.hWndAccessApp, SW_NORMAL) .OpenCurrentDatabase strMDB .DoCmd.OpenReport strReport, intView Do While Len(.CurrentDb.Name) > 0 DoEvents Loop End With End If fOpenRemoteReport_Exit: On Error Resume Next objAccess.Quit Set objAccess = Nothing Exit Function fOpenRemoteReport_Err: fOpenRemoteReport = False Select Case Err.Number Case 7866: MsgBox "Il database specificato " & vbCrLf & strMDB & _ vbCrLf & "č attualmente aperto in modalitā esclusiva. " & vbCrLf _ & vbCrLf & "Riaprilo in modalitā condivisa", _ vbExclamation + vbOKOnly, "Non posso aprire il database." Case 2103: MsgBox "Il report '" & strReport & _ "' non esiste nel database " _ & vbCrLf & strMDB, _ vbExclamation + vbOKOnly, "Report non trovato" Case 7952: fOpenRemoteReport = True Case 91: fOpenRemoteReport = False Case Else: MsgBox "Errore#: " & Err.Number & vbCrLf & Err.Description, _ vbCritical + vbOKOnly, "Runtime error" End Select Resume fOpenRemoteReport_Exit End Function
IL PROBLEMA:
Il problema e che se io apro il report per modificarlo lo riesco a modificare ma uscendo non salva le modifiche perchč mentre con gli ado non accedo permanentemente al DB (ci accedo soltanto per leggere-salvare dei dati), con gli oggeti di tipo Data il db č sempre "occupato"..
in altre parole mi dice che il DB e gia in uso da un'altra applicazione..
come posso ovviare al problema???
grazie a tutti!![]()
![]()

Rispondi quotando
