[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Error 2501 when executing a VBA query

Posted on 2005-04-17
2
Medium Priority
?
330 Views
Last Modified: 2012-05-05
I have been creating the queries from the Access 2003 database design view, then copy the code into my procedures once I am sure they give me the results I want.  This has been working fine until now.  The below is the code I copied from a working query but now when I try to run it in the procedure, I get a Runtime 2501 error, RUnSQL was canceled.  The only modificiation was changing the " to '.  Any suggestions?  

strMakeTable = "SELECT tblWeeklyUpload.AssignmentDate, tblWeeklyUpload.DateWorkedOn, " & _
               "tblWeeklyUpload.Lots, IIf([Transcode]='JNL','JNL (2)','') AS TranCode, " & _
               "[DateWorkedOn]-[tblWeeklyUpload.AssignmentDate] AS DaysDiff, tblSLA.SLA, " & _
               "IIf([SLA]>=[DaysDiff],'Yes','No') AS Met, tblSPCQualityControl.IndiaRanking,  " & _
               "tblSPCQualityControl.Ranking AS SFReviewRanking INTO tblIndiaJNLMetrics " & _
               "FROM (tblWeeklyUpload LEFT JOIN tblSLA ON tblWeeklyUpload.TransCode = tblSLA.ReturnMethod) " & _
               "LEFT JOIN tblSPCQualityControl ON tblWeeklyUpload.Account = tblSPCQualityControl.Account " & _
               "WHERE (((tblWeeklyUpload.AssignmentDate) Between [FORMS]![frmMenuManagementIndia].[txtStart] " & _
               "And [FORMS]![frmMenuManagementIndia].[txtEnd]) AND ((tblWeeklyUpload.TransCode)= 'JNL') AND " & _
               "((tblWeeklyUpload.EditTeam)='India')) "
0
Comment
Question by:ssmith94015
2 Comments
 
LVL 52

Accepted Solution

by:
Gustav Brock earned 2000 total points
ID: 13801673
Try this:

               "WHERE (((tblWeeklyUpload.AssignmentDate) Between #" & [FORMS]![frmMenuManagementIndia].[txtStart] & "# " & _
               "And #" & [FORMS]![frmMenuManagementIndia].[txtEnd] & "#) AND ((tblWeeklyUpload.TransCode)= 'JNL') AND " & _

or if you don't use the "reverse" US date format:

strDateStart = Format([FORMS]![frmMenuManagementIndia].[txtStart], "m\/d\/yyyy")
strDateEnd = Format([FORMS]![frmMenuManagementIndia].[txtEnd], "m\/d\/yyyy")

               "WHERE (((tblWeeklyUpload.AssignmentDate) Between #" & strDateStart & "# " & _
               "And #" & strDateEnd & "# AND ((tblWeeklyUpload.TransCode)= 'JNL') AND " & _

/gustav
0
 
LVL 25

Expert Comment

by:jrb1
ID: 13834748
Did you get this working?
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
In this article, I’ll look at how you can use a backup to start a secondary instance for MongoDB.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question