Help please, SQL 0952N SQLSTATE 57014

neh326

New member
Local time
Today, 11:47
Joined
Sep 15, 2011
Messages
4
RUNTIME ERROR 3146 PROCESSING WAS INTERUPTED DUE TO AN INTERRUPT SQL0952N....SQLSTATE=57014

You all were a huge help to me before so here I am again. :) I get the error above when I get to the docmd.strSQL. My code is supposed to identify the previous quarter and then pull the named data within that range. Instead, I get the error. I included the variable assignments in case the problem is there. Thanks in advance for your help! Nikki

Set dbUNDUP = OpenDatabase("Z:\Report.mdb")
dbUNDUP.QueryTimeout = 0

' Get date range
intMonth = Month(Now())

intYear = Year(Now())

' Get Qtr
If intMonth = 1 Or intMonth = 2 Or intMonth = 3 Then
intQtr = 4
intYear = Year(Now()) - 1
intStMonth = 10
Else
If intMonth = 4 Or intMonth = 5 Or intMonth = 6 Then
intQtr = 1
intStMonth = 1
Else
If intMonth = 7 Or intMonth = 8 Or intMonth = 9 Then
intQtr = 2
intStMonth = 4
Else
If intMonth = 10 Or intMonth = 11 Or intMonth = 12 Then
intQtr = 3
intStMonth = 7
End If
End If
End If
End If

' Get ranges
If intQtr = 4 Then
intSrtMonth = 10
intEndMonth = 12
intEndDay = 31
Else
If intQtr = 3 Then
intSrtMonth = 7
intEndMonth = 9
intEndDay = 30
Else
If intQtr = 2 Then
intSrtMonth = 4
intEndMonth = 6
intEndDay = 30
Else
If intQtr = 1 Then
intSrtMonth = 1
intEndMonth = 3
intEndDay = 31

End If
End If
End If
End If
intYearb = Year(Now()) - 1
intYearc = Year(Now())
dtRange1 = CDate("10/1/" & intYearb)
dtRange2 = CDate(intEndMonth & "/" & intEndDay & "/" & intYearc)

DoCmd.RunSQL "DELETE * FROM [Qtrly Dup Report 1]"

strSQL = "INSERT INTO [Qtrly Dup Report 1]" _
& " SELECT DISTINCT PHC05_PT.[PT_ID], PHC05_PT.[PT_SSN], PHC05_PT.[PT_CLTSPT_ID], PHC05_CFS.[CF_SVC_DT], PHC05_CFS.[CF_CA_PT_ID]," _
& " PHC05_PT.[PT_RACE_CD], PHC05_PT.[PT_SEX], PHC05_PT.[PT_BIRTH_DT]" _
& " FROM (PHC05_PT INNER JOIN PHC05_CASE ON PHC05_PT.[PT_ID] = PHC05_CASE.[CA_PT_ID]) INNER JOIN PHC05_CFS ON PHC05_CASE.[CA_SEQ_NO] = PHC05_CFS.[CF_CA_SEQ_NO] AND PHC05_CASE.[CA_PT_ID] = PHC05_CFS.[CF_CA_PT_ID]" _
& " WHERE ( PHC05_CFS.[CF_SVC_DT]" _
& " BETWEEN #" & dtRange1 & "# And #" & dtRange2 & "#" _
& " AND PHC05_PT.[PT_SEX]<>' ' AND PHC05_CFS.[CF_TM_ID] Between 300000 And 309999)" _
& " ORDER BY PHC05_PT.[PT_CLTSPT_ID], PHC05_CFS.[CF_SVC_DT], PHC05_CFS.[CF_CA_PT_ID], PHC05_PT.[PT_RACE_CD], PHC05_PT.[PT_SEX]"

DoCmd.RunSQL (strSQL)
 
Comment out this line:

dbUNDUP.QueryTimeout = 0

And please post back what happens.
 
I don't see any declarations for these:
intQtr = 1
intStMonth = 1
 
Last edited:
Again I don't see declarations for these:
dtRange1
dtRange2

Are they declared as date? Or are they declared as strings? (They should be declared as strings)

EDIT (A second look at your code I think DATE is OK)
 
Last edited:
Having spaces in your object names like this:

DoCmd.RunSQL "DELETE * FROM [Qtrly Dup Report 1]"

can cause all sorts of problems, any chance you can change the spaces to underscores?
 
The same error occurs. All my variables are declared at the top of my code, I didn't include all the code in my original post.


Comment out this line:

dbUNDUP.QueryTimeout = 0

And please post back what happens.
 
Try commenting out:
DoCmd.RunSQL "DELETE * FROM [Qtrly Dup Report 1]"

report what happens....
 

Users who are viewing this thread

Back
Top Bottom