none
Name Conflicts with Existing Module, project or object library when trying to copy or import objects RRS feed

  • Question

  • I have a database that appears to have gotten corrupted.

    I am trying to save a copy of the report so I can make a new version.  When I attempt to copy and paste in the current database shell I get an error "Name Conflicts with existing module, project, or object library", Then No Current Record, The search key was not found in any record.


    So, I tried using a tip on how to rebuild the database through text files.

    I have tried many permutations on:

    ? SaveAsText(acReport, "Budget Spreadsheet Report 1819", "D:\BudRep1819.txt")

    This produces Expected Function or Variable

    ? SaveAsText acReport, "Budget Spreadsheet Report 1819", "D:\BudRep1819.txt"

    I have tried: 

    ? Application.SaveAsText acReport, "Budget Spreadsheet Report 1819", "D:\BudRep1819.txt"

    ? SaveAsText 3, "Budget Spreadsheet Report 1819", "D:\BudRep1819.txt"

    I have also tried writing a VB Subroutine...  It compiles fine, but when I go to run :-(

    What am I missing?

    Many Thanks, Chris




    

    
    • Edited by Sql Dude Friday, February 8, 2019 8:45 PM
    Friday, February 8, 2019 8:41 PM

All replies

  • What happens if you import the report into a blank database?

    What dependencies (if any like queries, tables, libraries) does the report have?

    Both source and target databases are ACCDB format, right? You can't do an import if either one is an ACCDE.


    Bill Mosca
    www.thatlldoit.com
    http://tech.groups.yahoo.com/group/MS_Access_Professionals

    Friday, February 8, 2019 8:48 PM
  • I want to make sure that I understand you correctly. The report you copied is a report that exists in the same database where you paste the report, correct? It is strange that the error 'No current record' appears. In principle, this is only possible if you open the report. Is it true that you only copied the report and the message appears without opening the report?

    Further:

    What you do in your subSaveText procedure is completely wrong. First: the SaveAsText method is not a member of the Application object. Second: what you are trying to do here is to export the contents of a report to a text file. An Access report is a completely different object than a txt file.

    Friday, February 8, 2019 9:36 PM

  • What you do in your subSaveText procedure is completely wrong. First: the SaveAsText method is not a member of the Application object. Second: what you are trying to do here is to export the contents of a report to a text file. An Access report is a completely different object than a txt file.

    I beg to differ. SaveAsText is an unsupported method of Application. It's opposite is LoadFromText. You can see how these work if you use the Immediate Window and type:
    Application.SaveAsText 

    As soon as you hit the spacebar the intellisense will open with the parameters needed. All objects can be saved this way.


    Bill Mosca
    www.thatlldoit.com
    http://tech.groups.yahoo.com/group/MS_Access_Professionals

    Friday, February 8, 2019 10:55 PM
  • Thanks for your reply

    I am trying to import from an .accdb into an new empty .accdb.

    I think my database is in a very bad way.  

    What I find strange is that I can run the report fine, however if I copy it or try to import it into an empty shell I get these errors.

    What I also found is that the SaveAsText function fails for those reports that I can't copy, rename or import into a new shell.

    I discovered that my issue with doing the SaveAsText in the immediate window had nothing to do with the command as I had typed it, but it had to do with the corruption of the report.  I discovered it when I used code something like this below.

    Set dbs = CurrentDb() ' use CurrentDb() to refresh Collections

    Set cnt = dbs.Containers("Reports")
    For Each doc In cnt.Documents
       Application.SaveAsText acReport, doc.Name, "D:\AccessTemp\" & doc.Name & ".txt"
     Debug.Print doc.Name
    Next doc

    The above spit out 170+ reports, but many of them popped up with the errors...

    Is there anyway to save them?

    This is a bit unnerving, I had thought that I could recover any Access database...  This silent corruption is rather unnerving.

    Thanks, Chris

    Friday, February 8, 2019 11:42 PM
  • So you try to import a report from another database. You can do that with code (not your way), but you can also easily use a wizard. My Access is the Dutch version, so I do not exactly know the menu names. Probably it is: tab External data> New data source> From database. The rest speaks for itself.

    Pay attention! Make sure that the database in which you import is the same version (or higher) as the database in which the report to be imported is. Even better is to create an entire new database and import all objects there.

    As for SaveAsText. That is NOT a member of the Application object and you should NOT use this.

    I hope this will helps you.
    Saturday, February 9, 2019 9:59 AM
  • Hello,

    Thanks for your reply.  Sorry for the delay, we have been having some curious weather around here.

    My first step was to try and copy the report within the same database, that fails with the errors I mentioned initially.  The next step, was that I created a new database shell and attempted to import the objects into the new shell and I get the same errors.  I have also tried repairing the database, that did not work either.  So, I am trying to export the report using SaveAsText, which is a deprecated method, and that is failing also.   The report is huge and complex, I hope that I don't have to recreate it.

    Thanks for your input.

    Chris

    Tuesday, February 12, 2019 11:38 PM
  • The way you 'copy the report' is wrong. To copy a report simply select the report. Than press Ctrl+C and then Ctrl+V.

    When your database contains errors you can't retrieve, you can create also a whole new database and import all the objects as I mentioned earlier.

    The actions you did which generates errors is not the right way. To explain why, is irrelevant.

    Good luck!


    Wednesday, February 13, 2019 8:16 AM