A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Emailing an individual record



 
 
Thread Tools Display Modes
  #1  
Old June 7th, 2004, 04:51 PM
Julie C
external usenet poster
 
Posts: n/a
Default 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  
Old June 7th, 2004, 04:56 PM
Rick B
external usenet poster
 
Posts: n/a
Default 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  
Old June 7th, 2004, 05:00 PM
Rick B
external usenet poster
 
Posts: n/a
Default 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  
Old June 7th, 2004, 06:01 PM
juliec
external usenet poster
 
Posts: n/a
Default 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  
Old June 7th, 2004, 06:09 PM
Rick B
external usenet poster
 
Posts: n/a
Default 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  
Old June 7th, 2004, 10:11 PM
julie c
external usenet poster
 
Posts: n/a
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:53 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.