Web Hosting Talk







View Full Version : Access/Script


1boss1
08-16-2006, 07:08 AM
If anyone is proficent in Access databases, i'd appreciate some input...

The database is currently stored locally, and an installed script for direct debiting is causing conflict.

The error message is:

Script: C:\path to script\DBtoABA.js
Line: 420
Char: 7
Error: Check your date
Code: 80004005
Source: Microsoft JET Database Engine

The section of code around line 420 is:


//
//
function updateDb() {
var dbCon=openDb();
if(dbCon == null) return false;
for(var i=0; i<allData.length; i++) {
var data=allData[i];
var contribTo=new Date(); // default to today
var freq=data.PaymentFrequency.substr(0,1).toLowerCase();
var c=data.PaidToDate;
if(c) {
var y=parseInt(c.substr(0,4));
var m=parseInt(c.substr(4,2))-1;
var d=parseInt(c.substr(6,2));
contribTo=new Date(y, m, d);
}
var future=contribTo;
var dOffset=0;
var mOffset=0;
if(freq == 'w') dOffset=7;
if(freq == 'f') dOffset=14;
if(freq == 'm') mOffset=1;
if(freq == 'q') mOffset=3;
if(freq == 'h') mOffset=6;
if(freq == 'a') mOffset=12;
future.setMonth(future.getMonth()+mOffset, future.getDate()+dOffset);
var sqlDate="#"+
lpadnum2(future.getMonth()+1)+'-'+
lpadnum2(future.getDate())+'-'+
lpadnum2(future.getFullYear()%100)+
// " 12:00:01AM" +
"#";
if(!JP_DEBUG) {
dbCon.Execute('UPDATE '+dbTableContrib+
' SET '+conFields[2]+'='+sqlDate+
' WHERE ContributorID="'+data['ContributorID']+
'";');
}
else {
WScript.Echo('UPDATE '+dbTableContrib+
' SET '+conFields[2]+'='+sqlDate+
' WHERE ContributorID="'+data['ContributorID']+
'";');
}
}
dbCon.Close();
dbCon=null;
return true;
}


Line 420 starts with, bCon.Execute

I have a feeling the scripts fine however there's a problem with Access not interpreting the date correctly due to the Australian DD/MM/YY format.

Can anyone who's proficient in Access or has struck this problem before shed some light on this.

Cheers,

1boss1
08-17-2006, 02:10 AM
FYI:
Australia was selected in Regional & Language. I chose United States and the dates for PaidToDate swapped around and gave an error message when I did a Test Run.

The same Jet Engine Error happened with Banking this morning and again even though I chose Yes to 'Was Banking Transfer Successful' it still did not roll the dates forward.


Any pointers in remotely the right direction would be greatly appreciated, i have Google this Jet Engine error message and came up with absolutely zero.

:headache: