Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 375 Vote(s) - 3.51 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"Unspecified Error" 80004005 when creating new Access database, only on another workstation

#1
What I have is a JScript file that gets called by `cscript`, and this script is a proof-of-concept that creates a new Access 2007 format database, imports a set of VBA modules into the database, and then runs a subroutine from the imported modules.

This script works flawlessly on my own computer. I have Office 2013 installed. However, I brought this script over to a coworker's machine and had him attempt running it. On his machine, we get an error that looked something like, `createdb.js (22, 1): Unspecified error` and the error code is 80004005. My code, below:

<!-- language: lang-js -->

'use strict';

/**
* AcNewDatabaseFormat Enumeration
* Used with the NewCurrentDatabase method to specify the database format of the newly created database.
*/
var acModule = 5,
dbText = 10,
acNewDatabaseFormat = {
UserDefault: 0,
Access2000: 9,
Access2002: 10,
Access12: 12
};

var fs = new ActiveXObject('Scripting.FileSystemObject');
var access = new ActiveXObject('Access.Application');
var basePath = fs.GetParentFolderName(WScript.ScriptFullName);
var db, prop, vcsFolder, fCur, module;

//Create DB and set up some superficial things.
access.NewCurrentDatabase(basePath + '\\ImportTest.accdb', acNewDatabaseFormat.Access12, null, "", "");
//access.OpenCurrentDatabase(basePath + '\\ImportTest.accdb');
db = access.CurrentDb();
prop = db.CreateProperty('AppTitle', dbText, 'My New Database');
db.Properties.Append(prop);
prop = db.CreateProperty('StartUpForm', dbText, 'Main Form');
db.Properties.Append(prop);
db.Properties('UseMDIMode') = 1;

//Add MSAccess-VCS modules
vcsFolder = fs.GetFolder(basePath + '\\MSAccess-VCS');
fCur = new Enumerator(vcsFolder.files);
for (; !fCur.atEnd(); fCur.moveNext()) {
module = fCur.item().Name.replace('.bas', '');
access.LoadFromText(acModule, module, fCur.item());
}

access.Run('ImportAllSource');
access.Quit();

Line 22, character 1 is `access.NewCurrentDatabase(basePath + '\\ImportTest.accdb', acNewDatabaseFormat.Access12, null, "", "");`. Office (and Access!) 2007 is installed on his machine. We tried other `AcNewDatabaseFormat`s with no luck. What could possibly be the issue here?
Reply

#2
Since you're not using any of the optional parameters, just leave them off:

access.NewCurrentDatabase(basePath + '\\ImportTest.accdb', acNewDatabaseFormat.Access12);

You only need to specify a value for optional parameters if there are other parameters you want to use later in the argument list.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through