If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Emailing an individual record
I am trying to set up a control button, that when pushed will email a particular record in a form or table. I know that sendobject will email a table, form, query or report, but is there any way to isolate a particular record to send?
|
#2
|
|||
|
|||
Emailing an individual record
Yes. Here is my code in my form. Strip out what you need...
Private Sub Send_Email_Click() On Error GoTo Err_Send_Email_Click Dim msg If (IsNull([Reference])) Then msg = "Please select a record before creating the email." MsgBox (msg) 'If no record selected, stop procedure Exit Sub End If Dim varSubject As String Dim varText As String Dim varDocName As String Dim varRep As String varRep = IIf(IsNull([UserID]), "*Not Assigned*", [UserID]) varSubject = "Client: " & [Client_] & " - " & Left([ClientName], 15) & " Ref: " & [Reference] & " Assignment: " & [Assignment] & " - " & [Type] & " Rep: " & varRep varText = "The following Assignment has been made:" & Chr(10) & "Assigned Rep: " & varRep & Chr(10) & "Ref: " & [Reference] & Chr(10) & [Client_] & " - " & [ClientName] & Chr(10) & [Assignment] & " " & [Type] If [Assignment] Like "CONS*" Then varDocName = "Misc - Consulting Schedule Notification" Else: varDocName = "Misc - Install Schedule Notification" End If DoCmd.OpenReport varDocName, acViewPreview, "", "" ' Open the Report DoCmd.SendObject acSendReport, , "Snapshot Format", , , , varSubject, varText, True DoCmd.Close Exit_Send_Email_Click: Exit Sub Err_Send_Email_Click: MsgBox Err.Description Resume Exit_Send_Email_Click End Sub "Julie C" wrote in message ... I am trying to set up a control button, that when pushed will email a particular record in a form or table. I know that sendobject will email a table, form, query or report, but is there any way to isolate a particular record to send? |
#3
|
|||
|
|||
Emailing an individual record
Please disregard. I posted the wrong code.
Rick B "Rick B" wrote in message ... Yes. Here is my code in my form. Strip out what you need... Private Sub Send_Email_Click() On Error GoTo Err_Send_Email_Click Dim msg If (IsNull([Reference])) Then msg = "Please select a record before creating the email." MsgBox (msg) 'If no record selected, stop procedure Exit Sub End If Dim varSubject As String Dim varText As String Dim varDocName As String Dim varRep As String varRep = IIf(IsNull([UserID]), "*Not Assigned*", [UserID]) varSubject = "Client: " & [Client_] & " - " & Left([ClientName], 15) & " Ref: " & [Reference] & " Assignment: " & [Assignment] & " - " & [Type] & " Rep: " & varRep varText = "The following Assignment has been made:" & Chr(10) & "Assigned Rep: " & varRep & Chr(10) & "Ref: " & [Reference] & Chr(10) & [Client_] & " - " & [ClientName] & Chr(10) & [Assignment] & " " & [Type] If [Assignment] Like "CONS*" Then varDocName = "Misc - Consulting Schedule Notification" Else: varDocName = "Misc - Install Schedule Notification" End If DoCmd.OpenReport varDocName, acViewPreview, "", "" ' Open the Report DoCmd.SendObject acSendReport, , "Snapshot Format", , , , varSubject, varText, True DoCmd.Close Exit_Send_Email_Click: Exit Sub Err_Send_Email_Click: MsgBox Err.Description Resume Exit_Send_Email_Click End Sub "Julie C" wrote in message ... I am trying to set up a control button, that when pushed will email a particular record in a form or table. I know that sendobject will email a table, form, query or report, but is there any way to isolate a particular record to send? |
#4
|
|||
|
|||
Emailing an individual record
do you have code that does this? I would like to either email the entry that I am currently entering into the form, or would like to set up a button on the switchboard to email a particular record.
|
#5
|
|||
|
|||
Emailing an individual record
I can get you close. You would need to create a report to display the data
you want to email. when the button is clicked, you'd need to open the report and filter it for the current record. Then email it. Here is similar code from one of my databases that allows users to print an employee data sheet. It simply limits the report to the currently viewed record... Private Sub Print_Button_Click() If (IsNull([UserID])) Then ' If no employee selected, stop procedure Exit Sub End If DoCmd.OpenReport "Admin - Employee Worksheet", acViewNormal, "", "[UserID]=Forms![frmSINEmpDataMaintenance]![UserID]" End Sub "juliec" wrote in message ... do you have code that does this? I would like to either email the entry that I am currently entering into the form, or would like to set up a button on the switchboard to email a particular record. |
#6
|
|||
|
|||
Emailing an individual record
Here is what I tried. I created a control box on my form and called it bill_email. I created a query and here is the language.
SELECT [Bill Summary].[Bill Number], [Bill Summary].Hyperlink, [Bill Summary].Sponsor, [Bill Summary].Summary, [Bill Summary].Analysis, [Bill Summary].Background FROM [Bill Summary] WHERE ((([Bill Summary].[Bill Number])=forms!Bill_Summary!bill_email)); Bill Summary is the table, Bill Number, etc. are the fields. Bill_Summary is the form. I have another control box to run the macro to email the report generated from the query. When I hit the control box in the form, I get the query data sheet view, and it is empty. Any ideas? (It is important to note that I am not a programmer, and don't quite understand what I am doing!!!!) Thanks |
Thread Tools | |
Display Modes | |
|
|