Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 2501 on DoCmd.Openquery "QueryName"

Status
Not open for further replies.

ToyFox

Programmer
Jan 24, 2009
161
US
I have this function that runs a series of queries then runs a function that takes the end result and dumps it into an EXCEL template....

This routine works fine for me, but testing it on someone else's pc renders error 2501 on the the step3 query....
Why would this happen....Can someone shed some light here.


Function ReportBuild()
Dim strFileName As String
Dim Mo
Dim Dy

DoCmd.SetWarnings False
DoCmd.OpenQuery "AccountsWithLE"
DoCmd.OpenQuery "KYC_Remediation_Step1"
DoCmd.OpenQuery "KYC_Remediation_Step2"
DoCmd.OpenQuery "KYC_Remediation_Step3"
DoCmd.OpenQuery "KYC_Remediation_Step4"
DoCmd.OpenQuery "AML_Remediation_Report"
DoCmd.OpenQuery "AML Remediation Report Final"

'Call AML_Reports
Call RunAML_Report_With_Requirement_Type
DoCmd.SetWarnings True

strFileName = "G:\Business Compliance Group\Project\"

If Len(Day(Date)) = 1 Then
Dy = "0" & CStr(Day(Date))
Else
Dy = CStr(Day(Date))
End If

If Len(Month(Date)) = 1 Then
Mo = "0" & CStr(Month(Date))
Else
Mo = CStr(Month(Date))
End If


' A,B,C,D Report
strFileName = "G:\Business Group\Remediation Project\"
strFileName = strFileName & Mo & Dy & "-Remediation Report With Gradings.xls"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "AML Remediation Status Report (Weekly)", strFileName, , , True
 



If you're doing MS Access stuff, please post in an MS Access forum, like forum705.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top