472,145 Members | 1,484 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,145 software developers and data experts.

Open other access database from button inside access database

Hi,

I've created an access 2003 database that has a form with button called "open complaint database." This complaint database is also in access 2003. Here is my code to open the complaint database

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdOpenDb_Click()
  2.        Dim objAccess As Access.Application
  3.  
  4.          ' Open Access database
  5.          Set objAccess = CreateObject("Access.Application")
  6.          With objAccess
  7.             ' Make the application visible.
  8.             .Visible = True
  9.             ' Open the complaint database.
  10.             .OpenCurrentDatabase ("C:\complaint_2003.mdb"), False
  11.             Set objAccess = Nothing
  12.      End With
  13.      Exit Sub
  14. End Sub
when I click the button, I get this error "Microsoft office access has encountered a problem and need to be close. We are sorry for the incovenience" with send error report and don't send buttons.

I tested this code using access 97 to open another access 97 and it worked perfectly. Can anyone please help me on how to open access 2003 database from another access 2003, because I need to convert all my access 97 databases to access 2003?

Thank you in advance.
Oct 4 '07 #1
3 3673
Scott Price
1,384 Expert 1GB
Hi, I'm using Access 2003 also, and copying and pasting your code (with the one change of making the path point to a valid database on my computer) works just fine!

Check your references to make sure all are where they should be:

I've got these six selected:

Visual Basic for Applications
Microsoft Access 11.0 Object Library
OLE Automation
Microsoft DAO 3.6 Object Library
Microsoft ActiveX Data Objects 2.1 Library
Microsoft Office 12.0 Object Library

Other than that, I would say you've got a possibly corrupted database, or a possibly corrupted install of Access.

This is a link to Allen Browne's website with suggestions on Recovering Corruption , and Preventing Corruption .

Regards,
Scott
Oct 4 '07 #2
Hi, I'm using Access 2003 also, and copying and pasting your code (with the one change of making the path point to a valid database on my computer) works just fine!

Check your references to make sure all are where they should be:

I've got these six selected:

Visual Basic for Applications
Microsoft Access 11.0 Object Library
OLE Automation
Microsoft DAO 3.6 Object Library
Microsoft ActiveX Data Objects 2.1 Library
Microsoft Office 12.0 Object Library

Other than that, I would say you've got a possibly corrupted database, or a possibly corrupted install of Access.

This is a link to Allen Browne's website with suggestions on Recovering Corruption , and Preventing Corruption .

Regards,
Scott
Thank you for the reply and yes it was my access installation problem. Once I reinstalled office it's working fine.
Oct 5 '07 #3
Scott Price
1,384 Expert 1GB
Glad you got it working! Thanks for posting back with the solution.

Regards,
Scott
Oct 5 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by simplengrichard | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.