Private Sub Command0_Click()
On Error GoTo Err_Command0_Click
Dim db As DAO.Database
Dim rec As DAO.Recordset
Dim strID As String
Dim strPathCountry As String
Set db = CurrentDb()
Set rec = db.OpenRecordset("QUERYcr")
With rec
.MoveLast
.MoveFirst
Do While Not .EOF
strID = .Fields("GEOCODE")
strPathCountry = "U:\COUNTRY_REPORTS\" & .Fields("Entity") & ".rtf"
DoCmd.OuptputTo acOutputReport, "COUNTRY_REPORT", acFormatRTF, strPathCountry
.MoveNext
Loop
.Close
End With
Exit_Command0_Click:
Set strID = vbNullString
Set strPathCountry = vbNullString
Set rec = Nothing
Set db = Nothing
Exit Sub
Err_Command0_Click:
MsgBox Err.Description, vbExclamation, "Error #" & Err.Number
Resume Exit_Command0_Click
End Sub