It sounded like you had a resolution to your problem, so I didn't look at the code to closely.
You will also error on the words "pledge", "stock/property" & "embrace".
When you have text literals inside of a string (the select string), you have to use single quotes.
This won't work: "SELECT ... FROM..WHERE (something = "this" OR something = "that")"
This will work: "SELECT ... FROM..WHERE (something = 'this' OR something = 'that')"
I re-wrote your sub to make it easier to read (at least for me ) I use a string variable to create the SQL; then I can use the "Debug" command to print the SQL to the immediate window to see if it is formed correctly. If I have a question or want to test the SQL I can copy the string from the immediate window and paste it into a new query.
I did the same for the "OutputTo" command for the out put file.
And I commented out the querydef statements. You aren't using querydefs.
Here is the code:
Code:
Private Sub Command43_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
' Dim qdf As QueryDef
Dim sSQL As String
Dim outFile As String
Set db = CurrentDb
sSQL = "SELECT DISTINCT [PARISHUPDATE.FundID]"
sSQL = sSQL & " FROM PARISHUPDATE LEFT JOIN OPENPLEDGES"
sSQL = sSQL & " ON (PARISHUPDATE.FundID = OPENPLEDGES.FundID) AND (PARISHUPDATE.GiftDate = OPENPLEDGES.GiftDate)"
sSQL = sSQL & " AND (PARISHUPDATE.ConstituentID = OPENPLEDGES.ConstituentID) AND (PARISHUPDATE.GiftAmount = OPENPLEDGES.GiftAmount)"
sSQL = sSQL & " AND (PARISHUPDATE.PledgeBalance = OPENPLEDGES.PledgeBalance)"
sSQL = sSQL & " WHERE ((PARISHUPDATE.GiftType) = 'cash' Or (PARISHUPDATE.GiftType) = 'pledge' Or (PARISHUPDATE.GiftType) = 'stock/property')"
sSQL = sSQL & " AND ((PARISHUPDATE.CampaignID) = 'embrace'));"
' Debug.Print sSQL
Set rst = db.OpenRecordset(sSQL, dbOpenSnapshot)
Do While Not rst.EOF
strRptFilter = "[FundID] = " & Chr(34) & rst![FundID] & Chr(34)
outFile = "H:\Development\AOB Capital Campaign planning\Stewardship & Cultivation\Parish Update Reports\Report Destination" & "\" & rst.Fields("FundDescription") & Format(Date, "mmddyyyy") & ".pdf"
' Debug.Print outFile
DoCmd.OutputTo acOutputReport, "Commitments", acFormatPDF, outFile
DoEvents
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
' Set qdf = Nothing
Set db = Nothing
End Sub