Public Sub APRI_CON()
Set CON = New ADODB.Connection
' APRI CONNESSIONE
With CON
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open strDBPath
End With
End Sub
i can alert the user if the database have a paswword, before open it?
in my case have error in image
check if database have a passowrd
-
- PlatinumLounger
- Posts: 4362
- Joined: 26 Apr 2010, 17:36
check if database have a passowrd
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78545
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: check if database have a passowrd
You might use an error handler:
Code: Select all
Public Sub APRI_CON()
Set CON = New ADODB.Connection
On Error GoTo ErrHandler
' APRI CONNESSIONE
With CON
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open strDBPath
End With
Exit Sub
ErrHandler:
MsgBox "Cannot open the connection!", vbCritical
Set CON = Nothing
End Sub
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4362
- Joined: 26 Apr 2010, 17:36
Re: check if database have a passowrd
IN <<<< exactlly the same error in image, and code stop the execution, dont go in ErrHandler:....HansV wrote: ↑22 Jan 2021, 20:13You might use an error handler:
Code: Select all
Public Sub APRI_CON() Set CON = New ADODB.Connection On Error GoTo ErrHandler ' APRI CONNESSIONE With CON .Provider = "Microsoft.Jet.OLEDB.4.0" .Open strDBPath <<<<< End With Exit Sub ErrHandler: MsgBox "Cannot open the connection!", vbCritical Set CON = Nothing End Sub
-
- Administrator
- Posts: 78545
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- PlatinumLounger
- Posts: 4362
- Joined: 26 Apr 2010, 17:36