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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble opening database Make sure the drive is available

Status
Not open for further replies.

v5652

Programmer
Mar 19, 2008
76
IN
Hi,

I have an issue with my MS Access application.
When I start the application it gives an error
"Trouble opening database {Database File Path}
Make sure the drive is available.
Error: Not a valid password (3031)
"

even the password is correct.
I have tried opening the database with the same password it gets opened without error.
But when I open it through Frontend application it gives the above error.
If anybody has a solution to it please help.
I use it in MS Windows 10 Pro version with MS Access 2007 runtime.

Thanks in advance.
 
Access 2007 Runtime?

Try Access runtime 2013 or higher...

Just a hunch but there was a 32 vs 64 bit issue with Access 2010 which may be effecting the file.

Beyond that I would suggest various trouble shooting things involving the full version of Access.

Like compact and repair.
Removing the password.
Import everything to a fresh file.

Good luck!
 
Thanks for the reply.

I have sorted out this issue.
There was some code I have added few days back which runs while database connection because user complains for the slow speed of application.
It was creating this issue.

Below is the code for the reference.

Sub OpenAllDatabases(pfInit As Boolean)
' Open a handle to all databases and keep it open during the entire time the application runs.
' Params : pfInit TRUE to initialize (call when application starts)
' FALSE to close (call when application ends)
' Source : Total Visual SourceBook

Dim x As Integer
Dim strName As String
Dim strMsg As String

' Maximum number of back end databases to link
Const cintMaxDatabases As Integer = 2

' List of databases kept in a static array so we can close them later
Static dbsOpen() As DAO.Database

If pfInit Then
ReDim dbsOpen(1 To cintMaxDatabases)
For x = 1 To cintMaxDatabases
' Specify your back end databases
Select Case x
Case 1:
strName = gDatabasePath & gDatabaseName
Case 2:
strName = gDatabasePath & gDatabaseName
End Select
strMsg = ""

On Error Resume Next
Set dbsOpen(x) = OpenDatabase(strName)
If Err.Number > 0 Then
strMsg = "Trouble opening database: " & strName & vbCrLf & _
"Make sure the drive is available." & vbCrLf & _
"Error: " & Err.Description & " (" & Err.Number & ")"

End If

On Error GoTo 0
If strMsg <> "" Then
MsgBox strMsg
Exit For
End If
Next x
Else
On Error Resume Next
For x = 1 To cintMaxDatabases
dbsOpen(x).Close
Next x
End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top