By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,663 Members | 1,843 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,663 IT Pros & Developers. It's quick & easy.

Report from a single record

P: n/a
What I need to have happen is, that when the form is filled out by the user,
the user can produce a report of that record only. Any help would be
appreciated.

Thank you.
William Bradley
Come visit us at:
http://www.catholicmissionleaflets.org
Free Rosaries available at the above.
Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
You need a field to uniquely identify the record in the form.
This example assumes it is and autonumber named ID.

Private Sub cmdPrint_Click()
If Me.Dirty Then 'save first
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print."
Else
DoCmd.OpenReport "MyReport", acViewPreview, , "ID = " & Me.ID
End If
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"William Bradley" <br******@magma.ca> wrote in message
news:Bb********************@magma.ca...
What I need to have happen is, that when the form is filled out by the user, the user can produce a report of that record only. Any help would be
appreciated.

Nov 13 '05 #2

P: n/a
Allen Browne wrote:

Thank you for the following Allen. Previously I was able to produce a
report, of the current record in the form, which the user was able to
produce from an action button on the form. (Somehow I lost my notes on how
to do this.) Will the following allow me to do the same or will the user
have to select a record?

By the way, just got back a week ago from four weeks in Australia. Had a
grand time.
You need a field to uniquely identify the record in the form.
This example assumes it is and autonumber named ID.

Private Sub cmdPrint_Click()
If Me.Dirty Then 'save first
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print."
Else
DoCmd.OpenReport "MyReport", acViewPreview, , "ID = " & Me.ID
End If
End Sub


--
William Bradley
Come visit us at:
http://www.catholicmissionleaflets.org
Free Rosaries available at the above.
Nov 13 '05 #3

P: n/a
1. Put a command button on your form.

2. Set its On Click property to
[Event Procedure]

3. Click the build button beside the property.
Access opens the code window.

4. Paste the code between the "Private Sub..." and "End Sub" lines.

The code will print the current record in the screen.
It's getting cold now in Aus. Not by Canadian standards though. :-)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"William Bradley" <br******@magma.ca> wrote in message
news:Dq********************@magma.ca...
Allen Browne wrote:

Thank you for the following Allen. Previously I was able to produce a
report, of the current record in the form, which the user was able to
produce from an action button on the form. (Somehow I lost my notes on how
to do this.) Will the following allow me to do the same or will the user
have to select a record?

By the way, just got back a week ago from four weeks in Australia. Had a
grand time.
You need a field to uniquely identify the record in the form.
This example assumes it is and autonumber named ID.

Private Sub cmdPrint_Click()
If Me.Dirty Then 'save first
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print."
Else
DoCmd.OpenReport "MyReport", acViewPreview, , "ID = " & Me.ID
End If
End Sub

Nov 13 '05 #4

P: n/a
Allen Browne wrote:

Thank you Allen, I will follow up when I go back to the office next.

It was cool in Melbourne, but only had two days of rain. I think they would
like to have a week or more of rain.
1. Put a command button on your form.

2. Set its On Click property to
[Event Procedure]

3. Click the build button beside the property.
Access opens the code window.

4. Paste the code between the "Private Sub..." and "End Sub" lines.

The code will print the current record in the screen.
It's getting cold now in Aus. Not by Canadian standards though. :-)


--
William Bradley
Come visit us at:
http://www.catholicmissionleaflets.org
Free Rosaries available at the above.
Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.