Sub Print_All_Ships()
Dim rs As DAO.Recordset
Dim db As Database
Dim stSQL As String, stDate As String, stDBpath As String, stFTPpath As String
Dim stRptName As String, stParam As String, stLinkCriteria As String, stAlphabet As String, astAlpa(1, 26) As String
Dim stStart As String, stEnd As String, iloop As Integer
Dim iOKCancel As Integer
' GoTo rptalpha
stRptName = "Main_by_Ship"
Set db = CurrentDb
' Generate all the Ship reports
' GoTo rptleave:
stDBpath = CurrentProject.Path & "\"
stFTPpath = stDBpath & "Gazette\"
stSQL = "SELECT Ship.Ship FROM Ship WHERE (((Ship.ID)<> 26 and (Ship.ID)<> 27 and (Ship.ID)<> 60))ORDER BY Ship.Ship"
Set rs = db.OpenRecordset(stSQL)
Do While Not rs.EOF
' Need to convert any spaces in ship name to _ for website
stParam = LCase(Replace(rs!Ship, " ", "_"))
stLinkCriteria = "[Ship] = '" & rs!Ship & "'"
'DoCmd.CopyObject , stParam, acReport, stRptName
DoCmd.OpenReport stRptName, acViewPreview, , stLinkCriteria, acHidden
' Pause for 5 seconds to save report
'Pause (5)
DoCmd.OutputTo acOutputReport, stRptName, acFormatPDF, stFTPpath & stParam & ".pdf", False
DoCmd.Close acReport, stRptName
'DoCmd.DeleteObject acReport, stParam
rs.MoveNext
' iOKCancel = MsgBox("OK to proceed?", vbOKCancel)
' If iOKCancel = vbCancel Then
' Exit Sub
' End If
Loop
rs.Close
End Sub