tranchemontaigne
Registered User.
- Local time
- Today, 14:20
- Joined
- Aug 12, 2008
- Messages
- 203
I have a procedure that uses a recordset. The recordset is set to a string that contains an SQL statement. I can run the SQL statement in query view and return about 300 records. When I try to open the recordset defined by this SQL statement I receive no records. What's happening? Here's a code excerpt.
strSQL_Source = "SELECT ST_FILE_NBR, DECD_DTH_DT, DECD_AGE_YR, DECD_SEX, DECD_DTH_LOC_GEO_CD, DECD_RES_GEO_CD, Investigation, Outcome, Reportable, PrimaryCondition, AllDeathConditions FROM tblRecordsWithDeathTerms WHERE (((DECD_DTH_DT)>=#1/1/2002# And (DECD_DTH_DT)<=#1/24/2002#) AND ((DECD_AGE_YR)>=0 And (DECD_AGE_YR)<=120) AND (( Investigation) Like "*") AND (( Status) Like "*") AND (( Outcome) Like "*") AND (( Reportable) Like "*") AND (( Agent) Like "*"));
________
Z-SERIES
Set rstDeathCertExtract = New ADODB.Recordset
strActiveConnection = CurrentProject.Connection
rstDeathCertExtract.Open strSQL_Source, strActiveConnection, adOpenForwardOnly
intCounter = 0
Do Until rstDeathCertExtract.EOF
intCounter = intCounter + 1
rstDeathCertExtract.MoveNext
Loop
Debug.Print intCounter & " death certificates were selected in first pass of search" & Chr(10)
strSQL_Source = "SELECT ST_FILE_NBR, DECD_DTH_DT, DECD_AGE_YR, DECD_SEX, DECD_DTH_LOC_GEO_CD, DECD_RES_GEO_CD, Investigation, Outcome, Reportable, PrimaryCondition, AllDeathConditions FROM tblRecordsWithDeathTerms WHERE (((DECD_DTH_DT)>=#1/1/2002# And (DECD_DTH_DT)<=#1/24/2002#) AND ((DECD_AGE_YR)>=0 And (DECD_AGE_YR)<=120) AND (( Investigation) Like "*") AND (( Status) Like "*") AND (( Outcome) Like "*") AND (( Reportable) Like "*") AND (( Agent) Like "*"));
________
Z-SERIES
Last edited: