2 Replies Latest reply: May 15, 2014 9:56 AM by Ontiveros _ RSS

    Importing to Access

    Tony Smith

      I'm working on an Access application that takes data from a file using Monarch Pro V8.  The application works at times, but eventually I always get the following message:

       

      Session started:    Friday, March 09, 2007 11:39

      Set report file:    C:LighthouseARLenderAPendingFiles33_Debtor07312004.pdf

      Set model file:     C:LighthouseARLenderAMonarchModels33_DebtorStagingModel.xmod

      Cannot open file. File may be locked or in use by another application.

      Session ended:      Friday, March 09, 2007 11:40

       

      The file has opened and the model has opened, but the Access table appears to be locked.  This does not happen the first couple of times I run the routine, but it always happens eventually (the third or fourth time).

       

      Thanks for the help.

       

      Tony Smith

        • Importing to Access
          Dee Moore

          Hi Tony,

           

          You didn't mention how you are processing....

           

          Writing Command Line? Are you giving enough time between each file process?

           

          Have you tried processing an .xprj rather than seperate files?

           

          Writing VB? Do you close Monarch after each file process?

           

          When you get this message, do you check to see if Monarch is still running in the background (via Task Manager)?

           

          Regards,

          Dee Moore

          • Importing to Access
            Ontiveros _

            You could run code to create a file that is actually a linked table in Access (i.e. a .dbf or a .asc file

             

            Here's code I run for most automated monarch processes I have in Access. I have the code attached to the On-Click event of a command button called ImportDailyRecords.

             

            Private Sub cmdImportDailyRecords_Click()

            Dim MonarchObj As Object

             

                Set MonarchObj = CreateObject("Monarch32")

                MonarchObj.SetProjectFile ("G:GROUPSEVERYONEDaniProject Name.xprj")

                MonarchObj.ExportTable ("G:GROUPSEVERYONEDaniOutput table name.dbf")

                MonarchObj.CloseAllDocuments

                MonarchObj.Exit

                Set MonarchObj = Nothing

             

            End Sub