Connecting Tech Pros Worldwide Forums | Help | Site Map

Microsoft Access 97 report

Heather
Guest
 
Posts: n/a
#1: Nov 13 '05
I am trying to create a report which only displays the most current
record so the user can publish with word just the most current record
to email this out to a DL.
Thank you in advance.


Boiled egg
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Microsoft Access 97 report


Hi Heather

I had to do the very same thing (in Access 2000, hope its the same) -
but before I go into how let me make sure I understand you correctly.
Should the report be triggered from a form? So when you are looking at
a certain record in a form you can click and button and the record you
were viewing is outputted to word?

If yes, then this is how I did it.

1. Create your report. The report does not need to be based on a
query or have a datasource.

2. Drop unbound text boxes into the reports to hold your fields. Type
the names of the fields in your form into the report text boxes in the
following format:
=[Forms]![nameOfYourFormGoes Here]!nameOfFieldGoes Here
This is telling the report to use the currently selected record of the
specified form as the source for the specified field. Obviously for
the report to work the form must be open and a record selected.

3. Save your report. Go into Macros section, and create a new macro.
Set the first action for your Macro to 'OutputTo'. Set object type to
'Report', set object name to the name of your report, set output
format to Rich Text Format, and set the other fields here according to
your preference. Save the macro.

4. Open your form in design view and drop a command button into an
appropriate place. In the properties for your button, under 'on click'
select your newly create macro.

That should be it - although as an extra you could even get Access to
fire up the e-mail and attach the Word doc. To do this you use the
macro command 'SendObject'.

Hope this is what you were looking for!

Larry Daugherty
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Microsoft Access 97 report


Hi Heather,

You must have already designed your report for the wizard to do its best
work.

In design mode on the form in question and with wizards enabled on the
Toolbox, select the command button and create a command button on your form.
The wizard will step you through it. When the wizard is done. You'll need
to get into the event code for the Click procedure and insert a WHERE clause
something like

"[PeopleID] = " & PeopleID

in the OpenReport line.

HTH
--
-Larry-
--

"Heather" <HWilson1@cox.net> wrote in message
news:1105105447.919078.98860@z14g2000cwz.googlegro ups.com...[color=blue]
> I am trying to create a report which only displays the most current
> record so the user can publish with word just the most current record
> to email this out to a DL.
> Thank you in advance.
>[/color]


Heather
Guest
 
Posts: n/a
#4: Nov 13 '05

re: Microsoft Access 97 report


This works great! The way it is displayed now is my form is still
fine. My report now displays the correct data (only the current
record) except it puts it on as many pages as my form is. For example,
My form is 5 pages. (01/05/05, 01/06/05, 01/07/05, 01/08/05, 01/09/05)
My report displays (01/09/05, 01/09/05, 01/09/05, 01/09/05, 01/09/05)
Is there syntax to only display one of these pages?

Larry Daugherty
Guest
 
Posts: n/a
#5: Nov 13 '05

re: Microsoft Access 97 report


Hi Heather,

I don't understand your design. If the Primary Key field of your underlying
table is PeopleID then the where clause I gave you would open the report
with just one record in the report. Paste the code below into the Click
event of your Print Command Button. Substitute the names of the objects in
your application for the names in the subroutine below. The code below was
copied from the Click event of a command button that opens a report
Previewing one Person's record.

================================================== ======
Private Sub cmdPrintPersonRecord_Click()
On Error GoTo Err_cmdPrintPersonRecord_Click

Dim DocName As String

Me.Refresh

DocName = "rptLionPeople"
DoCmd.OpenReport DocName, A_PREVIEW, , "[PeopleID] = " & PeopleID

Exit_cmdPrintPersonRecord_Click:
Exit Sub

Err_cmdPrintPersonRecord_Click:
MsgBox Error$
Resume Exit_cmdPrintPersonRecord_Click

End Sub
================================================== =========

If the code doesn't work for you then post back with more information about
the design of your application. Especially give the name of the underlying
table and the names and datatypes of the first several fields in it. If the
above code returns several records then the Primary Key isn't a primary key
at all. When you set a primary key, no duplicates are allowed.

HTH
--
-Larry-
--

"Heather" <HWilson1@cox.net> wrote in message
news:1105127456.213109.218690@f14g2000cwb.googlegr oups.com...[color=blue]
> This works great! The way it is displayed now is my form is still
> fine. My report now displays the correct data (only the current
> record) except it puts it on as many pages as my form is. For example,
> My form is 5 pages. (01/05/05, 01/06/05, 01/07/05, 01/08/05, 01/09/05)
> My report displays (01/09/05, 01/09/05, 01/09/05, 01/09/05, 01/09/05)
> Is there syntax to only display one of these pages?
>[/color]


Heather
Guest
 
Posts: n/a
#6: Nov 13 '05

re: Microsoft Access 97 report


Hello Larry,
You are probably confused because that reply was supposed to be
attached and directed to boiled egg's response. I tried to click on
show options next to boiled eggs name and send that person an email,
but i dont know if it got there. I really appreciate the help though.
Maybe you can help by reading my original message at the top I guess
you see what I see, and then reading boiled eggs response and then my
question to boiled egg. Sorry for the confusion.
Heather

Heather
Guest
 
Posts: n/a
#7: Nov 13 '05

re: Microsoft Access 97 report


Boiled Egg,
This works great! The way it is displayed now is my form is still
fine. My report now displays the correct data (only the current
record) except it puts it on as many pages as my form is. For example,
My form is 5 pages. (01/05/05, 01/06/05, 01/07/05, 01/08/05, 01/09/05)
My report displays (01/09/05, 01/09/05, 01/09/05, 01/09/05, 01/09/05)
Is there syntax to only display one of these pages?
Does this have something to do with the primary key?
Thank you.
Heather

Larry Daugherty
Guest
 
Posts: n/a
#8: Nov 13 '05

re: Microsoft Access 97 report


Hi Heather,

You'd have to give us your table design and the design (SQL) of the query in
your report to better understand your issue. As I understand it now you're
getting identical data on several printed pages with different dates on each
page. What does that mean? A different date where. how displayed?

--
-Larry-
--

"Heather" <HWilson1@cox.net> wrote in message
news:1105361582.330019.195210@c13g2000cwb.googlegr oups.com...[color=blue]
> Boiled Egg,
> This works great! The way it is displayed now is my form is still
> fine. My report now displays the correct data (only the current
> record) except it puts it on as many pages as my form is. For example,
> My form is 5 pages. (01/05/05, 01/06/05, 01/07/05, 01/08/05, 01/09/05)
> My report displays (01/09/05, 01/09/05, 01/09/05, 01/09/05, 01/09/05)
> Is there syntax to only display one of these pages?
> Does this have something to do with the primary key?
> Thank you.
> Heather
>[/color]


Closed Thread