Hi,
I'm having an odd "issue", on our server we run a MS Access macro [loadData] to load data from an external db [AS400] to populate a destination MS Access db [DestinationData.mdb].
We created a [transfertData.bat] to put it on a Windows Tasks:
This works fine running [transfertData.bat] manually, both MS Access db's on the same location, [LoadData.mdb] carring loadData macro and destination db - [DestinationData.mdb] open correctly and the destination db is correctly populate. The odd thing happens when this [transfertData.bat] runs through a Tasks, in the background, only the [LoadData.mdb] runs and the data can't be populated on the destination db.Code:REM start LoadData db with Access "C:\Program Files (x86)\Microsoft Office\OFFICE15\MSACCESS.EXE" "C:\Trf\LoadData.mdb" /x LoadData
LoadData function on [LoadData.mdb]
Code:Function LoadData() Dim strConnectString As String Set rs = CurrentDb.OpenRecordset("Transfert", dbOpenDynaset) rs.AddNew rs![Description] = "Transfert of " & Date TranfertID = rs![Transfert_ID] rs.Update rs.Close Set rs = CurrentDb.OpenRecordset("Logging", dbOpenDynaset) ' configuration : strConnectString = "ODBC;DSN=AS400Server;UID=TestUser;PWD=TestPwd" Set dbSource = OpenDatabase("ODBC", dbDriverComplete, True, strConnectString) Set dbDestination = OpenDatabase("C:\Trf\DestinationData.mdb")


Windows tasks running MS Access db
Reply With Quote

