Connecting Tech Pros Worldwide Help | Site Map

Report help

Newbie
 
Join Date: Nov 2006
Posts: 4
#1: Nov 10 '06
Hello all,

I am no programer but I have been given a task to create an access program that will take in info from our customer service requests and then generate a report which will be sent off via email. I have the whole program done however i need to know how can you view only the last report. I have a contact number that generates a number for each entered request. so to give a clear idea this is how the program works enter contacts name address phone...etc choose which catalog they request. then i have a button at the bottom that when pressed prompts the email editor with the snapshot view of the reports all i need is to send the report i just entered. If there is a program code that would be helpful. again i am not a programer so if you can provide as much detail that would be great. Thanks!
msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,865
#2: Nov 12 '06

re: Report help


Sorry not enough information to help. Some questions and suggestions though.

Quote:
I have a contact number that generates a number for each entered request.
Where is this number stored and how does it relate to each report?

Quote:
all i need is to send the report i just entered
How is the report being generated. What is the records source of the report. You say the report is in sanpshot view but it is generating for all records. It sounds like you need to change the open report code to only show specific record

DoCmd.OpenReport "ReportName", , , "RequestNumber" = Me.RequestNumber

In this case RequestNumber would be a field in the reports record source and on the report (can be invisible) and it would also have to be a textbox on the form.
Newbie
 
Join Date: Nov 2006
Posts: 4
#3: Nov 13 '06

re: Report help


I have as the contact number it is a auto number that is the key. Yes all i am trying to do is when the report is made i just want it to show the last record entered and that is it. Right now when i double click the report icon i have all the records in there in decending order acording to the auto generate number but i want to only view the last record so that when sending it in an email the receiver does not have too have all the records just the last one that is ment for that person.
msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,865
#4: Nov 13 '06

re: Report help


Quote:

Originally Posted by mgornik

I have as the contact number it is a auto number that is the key. Yes all i am trying to do is when the report is made i just want it to show the last record entered and that is it. Right now when i double click the report icon i have all the records in there in decending order acording to the auto generate number but i want to only view the last record so that when sending it in an email the receiver does not have too have all the records just the last one that is ment for that person.

You need to find some way to specify the record. See my suggestion in previous post.
Newbie
 
Join Date: Nov 2006
Posts: 4
#5: Nov 13 '06

re: Report help


Would the "RequestNumber" be my Contact Number that i have in the report and in the form. this is an auto field. I assume i would enter this code into the On open in an event procedure.
msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,865
#6: Nov 13 '06

re: Report help


Quote:

Originally Posted by mgornik

Would the "RequestNumber" be my Contact Number that i have in the report and in the form. this is an auto field.

That should work

Quote:

Originally Posted by mgornik

I assume i would enter this code into the On open in an event procedure.

No it's behind a command button usually on the form designed to print the report.
Newbie
 
Join Date: Nov 2006
Posts: 4
#7: Nov 13 '06

re: Report help


Ok i tried that but maybe i am doing something wrong here is what i have for the code:
Private Sub Save_Click()
On Error GoTo Err_Save_Click

Dim stDocName As String


stDocName = "Danly IEM"
DoCmd.RunMacro "Macro1"
DoCmd.OpenReport "Danly IEM", , , "Contact_Number" = Me.Contact_Number
DoCmd.SendObject acSendReport, "Danly IEM", acFormatSNP, "doberg@danly.com", , , "Literature Request", "See the attached file for literature request", True



Exit_Save_Click:
Exit Sub

Err_Save_Click:
MsgBox Err.Description
Resume Exit_Save_Click

End Sub
msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,865
#8: Nov 13 '06

re: Report help


OK Change to

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Save_Click()
  3. On Error GoTo Err_Save_Click
  4. Dim stDocName As String
  5.  
  6. stDocName = "Danly IEM"
  7. DoCmd.RunMacro "Macro1"
  8. DoCmd.OpenReport "Danly IEM", , , "[Contact_Number]=" & Me.Contact_Number
  9. DoCmd.SendObject acSendReport, "Danly IEM", acFormatSNP, "doberg@danly.com", , , "Literature Request", "See the attached file for literature request", True
  10.  
  11. Exit_Save_Click:
  12. Exit Sub
  13.  
  14. Err_Save_Click:
  15. MsgBox Err.Description
  16. Resume Exit_Save_Click
  17.  
  18. End Sub
  19.  
Reply