Hi Everyone
Visual Studio 2005
VB 2005
Windows Application
I have a form with one combo box and a button
I want the user to make a selection from the combo box, click the button and have the application run an Access 2003 Macro, the database is embedded in my project.
I receive the following message when the button is clicked:
Microsoft Office Access can't open the database because it is missing, or opened exclusively by another user
The problem must be with the filepath in my code here is the code under the button click event:
If I change the path text to a copy of the Db on my C: drive "c:\LTDatabase. mdb" it works perfectly, so what is wrong with my path? ("|DataDirector y|LTDatabase.md b", False)
I'm sure it is something very basic that I'm missing....any thoughts would be appreciated.
Lone
UPDATE
It's just dawned on me that Access has no chance of finding "|DataDirectory |LTDatabase.mdb so how am I going to have this functionality in a deployed application mmmmmm scratching head
Visual Studio 2005
VB 2005
Windows Application
I have a form with one combo box and a button
I want the user to make a selection from the combo box, click the button and have the application run an Access 2003 Macro, the database is embedded in my project.
I receive the following message when the button is clicked:
Microsoft Office Access can't open the database because it is missing, or opened exclusively by another user
The problem must be with the filepath in my code here is the code under the button click event:
Code:
Select Case ComboBox1.SelectedItem
Case "Clear Form"
Dim oAccess As Access.ApplicationClass
'Start Access and open the database.
oAccess = CreateObject("Access.Application")
oAccess.Visible = False
oAccess.OpenCurrentDatabase("|DataDirectory|LTDatabase.mdb", False)
'Run the macro
'oAccess.Run("test2")
'Clean-up: Quit Access without saving changes to the database.
oAccess.DoCmd().Quit(Access.AcQuitOption.acQuitSaveNone)
System.Runtime.InteropServices.Marshal.ReleaseComObject(oAccess)
oAccess = Nothing
End Select
GC.Collect()
I'm sure it is something very basic that I'm missing....any thoughts would be appreciated.
Lone
UPDATE
It's just dawned on me that Access has no chance of finding "|DataDirectory |LTDatabase.mdb so how am I going to have this functionality in a deployed application mmmmmm scratching head
Comment