Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2004
    Location
    California
    Posts
    502

    Unanswered: Runtime error:'3010; qryRanconProg' already exist

    This error pops up (error: 'qryRanconProg' already exist) up when I run the below ONLY on the first DoCmd.

    The second and third DoCmds work flawlessly.

    Code:
    Private Sub Command53_Click()
    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel2003, "qryRanconProg", "D:\flw\Access\YTD", True
    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel2003, "qryRanconMENFProg", "D:\flw\Access\YTD", True
    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel2003, "qryRanconCustProg", "D:\flw\Access\YTD", True
    MsgBox ("Finished Exporting to D:\FLW\ACCESS\YTD Documents")
    End Sub
    I use these to past link data from an Access query to Excel files so I can link charts to them using Freelance Graphics.

    Any ideas?

    Thanks.

    Not the first time I've had this problem.

  2. #2
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    Does the file with the same name already exist? And does the file have a 'qryRanconProg' worksheet in it? That would be my guess. It is trying to overwrite existing data.

    If the file exists, but you don't care about keeping it, then use the Kill commmand to delete the file before you try to export the data.

    Code:
    On Error Resume Next
    Kill "D:\flw\Access\YTD"
    On Error Goto 0

  3. #3
    Join Date
    Mar 2004
    Location
    California
    Posts
    502
    Where would this code be placed, before the DoCmd or after the exportSpreadsheet?

    Also, will it break a link to an Excel sheet made from the previous DoCmd exPortSpreadsheet with the same name?

    I have links from Access queries to Excel via the ExportSpreadsheet and they are identical and overwrite perfectly. My charts and then linked back to these spreadsheets.

    Thanks.

  4. #4
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    The code should be put BEFORE the first DoCmd. What exactly do you mean by link? Do you have a Linked Table in an Access database? If so, as long as the filename is the same and you are storing it in the same location then it should be fine.

  5. #5
    Join Date
    Mar 2004
    Location
    California
    Posts
    502
    The suggested code did not defeat the error.

    I have Access queries (lots of them) that need to export the query results to an Excel one page worksheet. No problem here except some flag the previous error that the "qryRanconProg" already exist. WHY?

    The charts are linked into the Excel spreadsheets and as Freelance Graphics cannot link into Access.

    I'm stymied!

    Thanks . . . Rick

  6. #6
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    What happens if you switch the order of the DoCmds?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •