Report from a single record
Collapse
This topic is closed.
X
X
-
William BradleyTags: None -
Allen Browne
Re: Report from a single record
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.OpenRepor t "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" <bradleyw@magma .ca> wrote in message
news:BbmdnWbtuo kpUVjd4p2dnA@ma gma.ca...[color=blue]
> What I need to have happen is, that when the form is filled out by the[/color]
user,[color=blue]
> the user can produce a report of that record only. Any help would be
> appreciated.[/color]
-
William Bradley
Re: Report from a single record
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.
[color=blue]
> 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.OpenRepor t "MyReport", acViewPreview, , "ID = " & Me.ID
> End If
> End Sub
>[/color]
--
William Bradley
Come visit us at:
Mitratogel bandar mitra togel singapore hari ini & togel hongkong online serta situs penyedia data keluaran sgp hk pools langsung dari situs resmi toto sgp hk prize.
Free Rosaries available at the above.
Comment
-
Allen Browne
Re: Report from a single record
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" <bradleyw@magma .ca> wrote in message
news:DqGdnY1zQo eiRVjd4p2dnA@ma gma.ca...[color=blue]
> 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.
>[color=green]
> > 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.OpenRepor t "MyReport", acViewPreview, , "ID = " & Me.ID
> > End If
> > End Sub[/color][/color]
Comment
-
William Bradley
Re: Report from a single record
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.
[color=blue]
> 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. :-)
>[/color]
--
William Bradley
Come visit us at:
Mitratogel bandar mitra togel singapore hari ini & togel hongkong online serta situs penyedia data keluaran sgp hk pools langsung dari situs resmi toto sgp hk prize.
Free Rosaries available at the above.
Comment
Comment