michelecobb
New member
- Local time
- Today, 15:59
- Joined
- May 23, 2013
- Messages
- 4
I am new to Access. I am using Access 2010. I have searched and found several articles on emailing the current record shown on a form but haven't been able to get any of them to work.
My goal is to have a user input information onto the form and then have one button the user will click that will save the current record, email the current record in pdf, and then close the form.
The form name is: frmCorrectiveActions. The unique identifier for a record is: Corrective Action ID.
The last coding I tried is below. I know something is wrong but have copied this code from another post about emailing forms so I'm not even sure what half of it means. I am getting the message Run-time error '3075': Syntax error (missing operator) in query expression "Corrective Actions ID = 23' and when I hit debug this is highlighted: qry.SQL = strSQL
form Private Sub Email_Click()
Dim qry As DAO.QueryDef
Dim strSQL As String
Dim ReportQueryName As String
ReportQueryName = "qryCorrectiveActions"
Set qry = CurrentDb.QueryDefs(ReportQueryName)
strSQL = "SELECT * FROM tblCorrectiveActions WHERE Corrective Actions ID = " & Me.Corrective_Action_ID
qry.SQL = strSQL
DoCmd.Requery [qryCorrectiveActions]
DoCmd.SendObject acSendForm, frmCorrectiveActions, acFormatPDF, "variable", , , _
"Corrective Actions", "Attached please find Corrective Actions notification"
End Sub
Any help would be greatly appreciated!
My goal is to have a user input information onto the form and then have one button the user will click that will save the current record, email the current record in pdf, and then close the form.
The form name is: frmCorrectiveActions. The unique identifier for a record is: Corrective Action ID.
The last coding I tried is below. I know something is wrong but have copied this code from another post about emailing forms so I'm not even sure what half of it means. I am getting the message Run-time error '3075': Syntax error (missing operator) in query expression "Corrective Actions ID = 23' and when I hit debug this is highlighted: qry.SQL = strSQL
form Private Sub Email_Click()
Dim qry As DAO.QueryDef
Dim strSQL As String
Dim ReportQueryName As String
ReportQueryName = "qryCorrectiveActions"
Set qry = CurrentDb.QueryDefs(ReportQueryName)
strSQL = "SELECT * FROM tblCorrectiveActions WHERE Corrective Actions ID = " & Me.Corrective_Action_ID
qry.SQL = strSQL
DoCmd.Requery [qryCorrectiveActions]
DoCmd.SendObject acSendForm, frmCorrectiveActions, acFormatPDF, "variable", , , _
"Corrective Actions", "Attached please find Corrective Actions notification"
End Sub
Any help would be greatly appreciated!
Last edited: