Hi,
I am trying to view an access report in visual basic, i know it can be done but Im having trouble. Please could you have a look at my code and see if anything looks wrong as i get the following error...... "run time error '7866' access can't open the database because it is missing, or open exclusively by another user."

VB Code:
  1. Dim AcApp As Access.Application
  2. Set AcApp = New Access.Application
  3. Dim strPath As String
  4.  
  5. strPath = App.Path
  6. strPath = strPath & "C:\Documents and Settings\Tim\Desktop\Program\Database\database.mdb"
  7.  
  8. AcApp.OpenCurrentDatabase strPath
  9. AcApp.Visible = True
  10. AcApp.DoCmd.OpenReport "payments", acViewPreview
  11. AcApp.DoCmd.Maximize
  12.  
  13. AcApp.Quit
  14. Set AcApp = Nothing

When i got the error message I checked the directory names and they are fine. So i then tried to close the database connection with this code before the report coding began...

VB Code:
  1. cn.close

and I got this message "object variable or block variable not set"
If you can help me I will be very grateful.

I am using vb6 and a access 97 database. I have selected the microsoft access 10.0 object library.