Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to display the last record in a Query

Status
Not open for further replies.
Nov 27, 2002
8
US
Ultimate Goal:
I want to e-mail data from a form to a particular e-mail Address using "SnapShot" format.
(the email part I don't have an issue with)

Situation:
1. Can't email a form using "SnapShot", snapshot only works with reports. (not a problem)

2. Need to make a query that will extract out just that record id based on what is displayed on the form. The report would generate its data from that query.

Thoughts:
1. In VB6 I could create a SQL statement that could extract the forms record id and write this information to a temp table. The report would then be feed off this temp table.

Problem:
1. Not sure how to write the VBA could within Access to execute.
2. Not sure if this is the best way.

Any suggestions would be welcome.
 
2. this is the normal good way, yes.

when you create your report, in the ID criteria of the recordsource you can put
Code:
Forms!FormName!ID
you will have to tweak this code for Form Name and ID field name. then the report will open to the ID that is on the form.

then put a button on the form. using the wizard you can choose REPORT FUNCTIONS + MAIL REPORT, blah just follow the prompts.
then look at the button's OnCLick event code.

it will say something like this:
Code:
    Dim stDocName As String

    stDocName = "Chart1"
    DoCmd.SendObject acReport, stDocName

you will want to tweak the last line. you can look in HELP for SendObject parameters. or just type a comma after stDocName and it will prompt you for more info. i think snapshot is acformatsnp.

hope this helps--g
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top