I mocked up your table and report and used this code.
Note:
1) I changed temp from string to integer
2) I substituted an "_" for your space in FileName.
3)I commented out the OutputTo line (line 140) as that is giving an error that crashed my Access -- I don't have the pdf add-in installed. I was getting an error msg on 140 saying there was a format issue...
4) You will save yourself lots of debugging time if you do not use embedded spaces or special characters in field and object names. Use only alph-numeric chars and "_" underscore.
Code:
Public Function CreateCustomerPDF()
'On Error GoTo PDF_Err
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim myfacility As String
Dim mydate As Date
Dim MyFileName As String
Dim mypath As String
Dim temp As Integer
Dim begindate As Date
Dim enddate As Date
Dim rangedate As Date
Dim datetrue As String
10 On Error GoTo CreateCustomerPDF_Error
20 mypath = "C:\Customer\PDF Files\"
30 Set db = CurrentDb()
40 Set rs = db.OpenRecordset("SELECT * FROM [tbl Responses]", dbOpenDynaset)
50 begindate = CDate(InputBox("Enter Inspection begin date!(mm/dd/yyyy)", "Inspection start date"))
60 enddate = CDate(InputBox("Enter Inspection end date!(mm/dd/yyyy)", "Inspection end date"))
70 Do While Not rs.EOF
80 temp = rs("Facility Number")
90 myfacility = rs("Facility Number")
100 mydate = rs("service date")
110 MyFileName = myfacility & "_" & "Inspection" & " " & Format(mydate, "mm-dd-yyyy") & ".pdf"
'
120 Debug.Print "temp " & temp; vbCrLf & " myDate " & mydate & vbCrLf & " begindate " & begindate & vbCrLf & " enddate; " & enddate; ""
130 DoCmd.OpenReport "Rpt Form Responses", acViewReport, , "[Facility Number]= " & temp & " And [Service Date] Between #" & begindate & "# And #" & enddate & "#"
140 ' DoCmd.OutputTo acOutputReport, "", acFormatPDF, mypath & MyFileName
150 DoCmd.Close acReport, "Rpt Form Responses"
160 rs.MoveNext
170 Loop
PDF_Exit:
180 Exit Function
'PDF_Err:
' MsgBox "Incorrect Date Format, Please try again", vbCritical, "Incorrect Date"
' Resume PDF_Exit
190 On Error GoTo 0
200 Exit Function
CreateCustomerPDF_Error:
210 If Err.number = 3464 Then
220 Debug.Print MyFileName
230 End If
240 MsgBox "Error " & Err.number & " " & Erl & " (" & Err.Description & ") in procedure CreateCustomerPDF of Module AWF_Related"
End Function
It does iterate the recordset. Here's a sample from my test data
Code:
temp 1
myDate 23/02/2014
begindate 22/02/2014
enddate; 01/06/2014
temp 101
myDate 26/02/2014
begindate 22/02/2014
enddate; 01/06/2014
temp 219
myDate 12/10/2013
begindate 22/02/2014
enddate; 01/06/2014
temp 222
myDate 02/03/2014
begindate 22/02/2014
enddate; 01/06/2014
temp 233
myDate 27/09/2014
begindate 22/02/2014
enddate; 01/06/2014
temp 244
myDate 13/08/2014
begindate 22/02/2014
enddate; 01/06/2014