Donna Tunstall
Registered User.
- Local time
- Today, 19:33
- Joined
- Aug 16, 2001
- Messages
- 17
Any chance either one of you could elaborate on this topic a bit more? This sounds like exactly what I need to do:
I have code for ONE QUERY that loops through a list of sales reps and applies each name in turn as the criteria and exports the report under that person's name. I've been trying to add an extra loop that would go through the first query, loop through that and generate each person's report; THEN go to the next query and do the same thing, etc, etc. The rsCriteria loop works perfectly when I type in the name of the queries/reports as text strings.
I obtained and modified the original loop code from Roger's Access Library (PrintingSpecificReports) : he's labelled that "Expert Level" and I ain't nowhere close to that.
Here's my lay attempt at adding that extra loop - would anyone be able to point me in the right direction for correcting this. The error happens at the Set qdf line "Error in FROM clause".
Thanks in advance.
rsReports.MoveFirst
Do Until rsReports.EOF
rsCriteria.MoveFirst
Do Until rsCriteria.EOF
strSQL = "SELECT * FROM rsReports![QueryReportMain] WHERE "
strSQL = strSQL & "[Manager] = '" & rsCriteria![Manager] & " '"
db.QueryDefs.Delete rsReports![QueryReport]
Set qdf = db.CreateQueryDef(rsReports![QueryReport], strSQL)
DoCmd.OutputTo acReport, rsReports![ReportName], "SnapshotFormat(*.snp)", "X:\Anixter\Monthly IAP Info\Bizman\" & rsCriteria![FileName] & rsReports![alias] & ".snp", False, ""
rsCriteria.MoveNext
Loop
rsCriteria.close
rsReports.MoveNext
Loop
rsReports.close
I have code for ONE QUERY that loops through a list of sales reps and applies each name in turn as the criteria and exports the report under that person's name. I've been trying to add an extra loop that would go through the first query, loop through that and generate each person's report; THEN go to the next query and do the same thing, etc, etc. The rsCriteria loop works perfectly when I type in the name of the queries/reports as text strings.
I obtained and modified the original loop code from Roger's Access Library (PrintingSpecificReports) : he's labelled that "Expert Level" and I ain't nowhere close to that.
Here's my lay attempt at adding that extra loop - would anyone be able to point me in the right direction for correcting this. The error happens at the Set qdf line "Error in FROM clause".
Thanks in advance.
rsReports.MoveFirst
Do Until rsReports.EOF
rsCriteria.MoveFirst
Do Until rsCriteria.EOF
strSQL = "SELECT * FROM rsReports![QueryReportMain] WHERE "
strSQL = strSQL & "[Manager] = '" & rsCriteria![Manager] & " '"
db.QueryDefs.Delete rsReports![QueryReport]
Set qdf = db.CreateQueryDef(rsReports![QueryReport], strSQL)
DoCmd.OutputTo acReport, rsReports![ReportName], "SnapshotFormat(*.snp)", "X:\Anixter\Monthly IAP Info\Bizman\" & rsCriteria![FileName] & rsReports![alias] & ".snp", False, ""
rsCriteria.MoveNext
Loop
rsCriteria.close
rsReports.MoveNext
Loop
rsReports.close