run time error "2302"

l1ttledb

New member
Local time
Today, 07:51
Joined
Oct 1, 2009
Messages
3
Hi All,

Just to explain, I know very little about access at all and the guy who built this report is on longterm sick leave.

My manager always gives me stuff like this to fix and i can normally work it out but not this time. I have manually exported the queries needed for today but I cant fix the below output error and this is run everyday by another team.

When the report is finished it normally outputs four excel files but instead is giving me the error in the title, when i go into debug it had the output code at the end highlighted. Can this be fixed?

Private Sub import_data_DblClick(Cancel As Integer)
MyVar = MsgBox("Data Import Started", vbOKOnly, "IMPORT MESSAGE")
DoCmd.TransferText acImportDelim, "Interactions Import Specification", "Interactions", "d:\Automated MS Access\Collections\Interactions.txt", 0
DoCmd.DeleteObject acTable, "POLREM"
DoCmd.TransferText acImportDelim, "POLREM Import Specification", "POLREM", "d:\Automated MS Access\Collections\POLREM.txt", 0
MyVar = MsgBox("Data Imported", vbOKOnly, "IMPORT MESSAGE")

MyVar = MsgBox("Queries are about to run, enter data where prompted. DO NOT PRESS CANCEL", vbOKOnly, "QUERY MESSAGE")
DoCmd.SetWarnings False
DoCmd.OpenQuery "POLREM for Bill Date"
DoCmd.Close acQuery, "POLREM for Bill Date", acSaveYes
DoCmd.OpenQuery "POLREM for Bill Date Exceptions"
DoCmd.Close acQuery, "POLREM for Bill Date Exceptions", acSaveYes
DoCmd.OpenQuery "Business Type Exceptions"
DoCmd.Close acQuery, "Business Type Exceptions", acSaveYes
DoCmd.OpenQuery "Business Type Exceptions Review"
DoCmd.Close acQuery, "Business Type Exceptions Review", acSaveYes
DoCmd.OpenQuery "Auto Remind query before Clarify match"
DoCmd.Close acQuery, "Auto Remind query before Clarify match", acSaveYes
DoCmd.OpenQuery "Auto Remind query NOT NONE"
DoCmd.Close acQuery, "Auto Remind query NOT NONE", acSaveYes
DoCmd.OpenQuery "Auto Remind query NULL"
DoCmd.Close acQuery, "Auto Remind query NULL", acSaveYes
DoCmd.OpenQuery "Auto Remind Clarify Review"
DoCmd.Close acQuery, "Auto Remind Clarify Review", acSaveYes
DoCmd.OpenQuery "Auto Remind query Without Matching Interactions"
DoCmd.Close acQuery, "Auto Remind query Without Matching Interactions", acSaveYes
DoCmd.OpenQuery "CORPU"
DoCmd.Close acQuery, "CORPU", acSaveYes

DoCmd.SetWarnings True

MyVar = MsgBox("Files are now ready to export", vbOKOnly, "EXPORT MESSAGE")
DoCmd.OutputTo acOutputQuery, "Business Type Exceptions Review", acFormatXLS, "LIQ and OSP Review.xls", True
DoCmd.OutputTo acOutputQuery, "Auto Remind query NOT NONE", acFormatXLS, "Pay Plan exceptions.xls", True
DoCmd.OutputTo acOutputQuery, "Auto Remind query NULL", acFormatXLS, "Pay Plan is empty.xls", True
DoCmd.OutputTo acOutputQuery, "Auto Remind Clarify Review", acFormatXLS, "Reviews.xls", True
DoCmd.OutputTo acOutputQuery, "Auto Remind query Without Matching Interactions", acFormatXLS, "Autoremind.xls", True
DoCmd.OutputTo acOutputQuery, "CORPU", acFormatXLS, "CORPU.xls", True

MyVar = MsgBox("Program Finished", vbOKOnly, "END MESSAGE")

End Sub

Many thanks
 
What happens if you try to perform this action manually. Is there a problem with the query? or its underlying data?

What type of query is it?

David
 
What happens if you try to perform this action manually. Is there a problem with the query? or its underlying data?

What type of query is it?

David

There is no problem manually exporting from database view and all the underlying data is correct.

Its basically a clash between a call logging system and a debt system, so for eg we ask " If a customer has an "interaction" and a "debt" of < 200 we will bar them sry not really good with code. the are loads of similar criteria.

I just ran it again on my computer and it worked fine ( i didn't make any changes and i had run it at least ten times ) so i copied the whole report / database to my colleague's computer but it still doesn't work
 
If it works for you but not a colleague it could well be due to the path it is trying to save to.
Try adding the path to the OutputTo command

DoCmd.OutputTo acOutputQuery, "Business Type Exceptions Review", acFormatXLS, "C:\My Documents\LIQ and OSP Review.xls", True

For example
 

Users who are viewing this thread

Back
Top Bottom