Hi everybody

I am trying to get a report of ms access database(mdb database).


code Code:
  1. Private cn As ADODB.Connection
  2.  
  3. Private Sub Command1_Click()
  4. Dim cn As New ADODB.Connection
  5. Dim acc As Object
  6. Set acc = CreateObject("Access.Application")
  7. Dim strDbName As String
  8. strDbName = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source =" & App.Path & "\Pharmacy OP Ver 1.0.0.mdb "
  9. acc.OpenCurrentDatabase strDbName
  10. acc.DoCmd.OpenReport RptstaffDed, acViewPreview
  11. End Sub

I am trying to connect it, but there is an error that comes
"Microsoft Access can't open the database because it is missing or opened exclusively by another user, or it is not an ADP file.

Can somebody point out my mistakes

Please Help