I've been having some problems with this code and I can't figure out why it's giving me this error message: "Could not find the file '<path>\3.mdb'. It's looking for a mdb called '3' on my desktop (I replaced the actual path with '<path>' in the error
message). I don't have a database named that. I've checked the back end paths and everything appears to be linked fine. I run other codes and don't have any problems, just this one. It gives me the error message after I click Yes in the Message box.
What's odd is that I took the same code for an OutputTo function and just adjusted the actions to send an email instead.
Any ideas?
Dim dbs As DAO.Database
Dim qdf As DAO.QueryDef
Dim prm As DAO.Parameter
Dim rs As DAO.Recordset
Set dbs = CurrentDb
Set qdf = dbs.QueryDefs("BlowIn_qryDistinct")
For Each prm In qdf.Parameters
prm = Eval(prm.Name)
Next prm
Set rs = qdf.OpenRecordset
On Error GoTo Err_PO_Click
If MsgBox("Issue Grids?", vbYesNo + vbQuestion, "Confirmation Required") = vbYes Then <ERROR MESSAGE APPEARS AFTER CLICKING "YES">
rs.MoveFirst
Do Until rs.EOF
DoCmd.CopyObject acReport, rs![EventTitle] & " 2012 Blow In Grids " & Format(Now(), "MM-DD-YY"), acReport, "BlowIn_rptGrid"
DoCmd.OpenReport rs![EventTitle] & " 2012 Blow In Grids " & Format(Now(), "MM-DD-YY"), acViewPreview, , "EventTitle = """ & rs!EventTitle & """"
DoCmd.SendObject acSendReport, rs![EventTitle] & " 2012 Blow In Grids " & Format(Now(), "MM-DD-YY"), acFormatPDF, rs!EmailTo, rs!EmailCC, , rs!EventTitle & " 2012 Blow In Grids", "Please find the latest blow in grids attached. Thank you.", True
DoCmd.Close acReport, rs![EventTitle] & " 2012 Blow In Grids " & Format(Now(), "MM-DD-YY"), acSaveNo
DoCmd.DeleteObject acReport, rs![EventTitle] & " 2012 Blow In Grids " & Format(Now(), "MM-DD-YY")
rs.MoveNext
Loop
End If
Exit_PO_Click:
MsgBox ("Grids Issued")
rs.Close
Set rs = Nothing
Set dbs = Nothing
Exit Sub
Err_PO_Click:
MsgBox Err.Description
Resume Exit_PO_Click