472,122 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,122 software developers and data experts.

Report from a single record

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
4 13233
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
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
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
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.

Similar topics

reply views Thread by William Bradley | last post: by
2 posts views Thread by Bob Quintal | last post: by
reply views Thread by willemp | last post: by
reply views Thread by AmateurDBer | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.