Issues Creating a Access File
OK, what i am looking to do is have a program that creates a MS Access File. I can get my code create the file, but
then when i go to pass the Database to a dao.Database variable so I can
add database password and exicute the SQL to create the default tables
and data. I am getting a error saying it can't load the type
library/DLL.
Here is my code:
private void CreateNewMDB(string Target)
{
Microsoft.Office.Interop.Access.Application oAccess = new Microsoft.Office.Interop.Access.Application();
oAccess.NewCurrentDatabase(Environment.CurrentDirectory + @"\data\" + Target + ".mdb");
dao.Database oData = oAccess.CurrentDb();
oData.NewPassword("", "password");
BuildDefualts(oData, Target);
oData.Close();
oAccess.CloseCurrentDatabase();
}
The
part it errors out is "dao.Database oData = oAccess.CurrentDb();". I
have all the object refs properly listed. I even tried setting them to
copy local. Now i have been hunting and hunting all over the place. All i can ever seem to find is Stuff dealing mostly with Ecel never Access.
Any one have a idea what i have done wrong?