View Full Version : Using code in Access Pro 2007


Albert24
07-16-2008, 08:26 PM
I am having a problem using old code in Access Pro 2007.

This is the code I am using in Access 2003 without any problems but when I try this code in Access Pro 2007. I receive an error message.

Function Macro1()
On Error GoTo Macro1_Err

DoCmd.TransferSpreadsheet acExport, 8, "Payment Audit_1", "c:\testing\Audit.xls", False, ""
DoCmd.TransferSpreadsheet acExport, 8, "Vending Audit_2", "c:\testing\Audit.xls", False, ""
DoCmd.TransferSpreadsheet acExport, 8, "Coolers Audit_3", "c:\testing\Audit.xls", False, ""


Macro1_Exit:
Exit Function

Macro1_Err:
MsgBox Error$
Resume Macro1_Exit

End Function

Can someone help? Thanks in advance.

Rich
07-16-2008, 10:59 PM
What error message?

Albert24
07-17-2008, 10:15 AM
The error message that I receive in Access 2007 is 'cannot define field more than once'. There are no duplicates in the queries. The code works perfect in Access 2003.

Please help!

Albert24
07-17-2008, 03:49 PM
I cannot figure out why I am having a problem with this macro/code in Access 2007.

I am totally frustrated with this problem. Can someone help? I am trying to transfer multiply queries to a worksheet in the same workbook. I was able to do this in Access 2003 using the transferspreadsheet action in a macro. I did not see the transferspreadsheet action in Access 2007. I decided to convert the macro to code from Access 2003 and input the code in Access 2007 and use the macro runcode action. I thought this would be simple but for some reason this is not working. I continue to receive an error message in Access 2007 'Cannot define field more than once'.

Please help! Please help!