Results 1 to 3 of 3
  1. #1
    Fulatins is offline Novice
    Windows 10 Access 2003
    Join Date
    Jul 2019
    Posts
    2

    Question Windows tasks running MS Access db

    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:
    Code:
    REM start LoadData db with Access
    "C:\Program Files (x86)\Microsoft Office\OFFICE15\MSACCESS.EXE" "C:\Trf\LoadData.mdb" /x LoadData
    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.

    Click image for larger version. 

Name:	snag01073.png 
Views:	25 
Size:	6.3 KB 
ID:	39223

    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")

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    Is there a reason you're using two databases for this function. Can't you write your import routine in destinationdata.mdb and run it from there? Or is destinationdata where your user interface is stored and you don't want to impact the UI at all? What is the rest of your routine doing? if you are updating tables in the destinationdata database you could simply link those tables into your LoadData database and update them through a series of queries etc rather than having to open destinationdata at all.

  3. #3
    Fulatins is offline Novice
    Windows 10 Access 2003
    Join Date
    Jul 2019
    Posts
    2
    Solved, something wrong with the AD "Service" account used for this tasks. Putted my on and is solved!

    Thx anyway!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 03-17-2018, 06:24 PM
  2. How to Identify Running Tasks Using VBA
    By EddieN1 in forum Programming
    Replies: 0
    Last Post: 06-15-2016, 04:33 PM
  3. Replies: 3
    Last Post: 04-29-2015, 04:41 PM
  4. Replies: 18
    Last Post: 10-21-2013, 05:13 PM
  5. Replies: 12
    Last Post: 02-09-2012, 02:27 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums