Printing current record

  • Thread starter Thread starter Ian Tranter
  • Start date Start date
I

Ian Tranter

We have a report linked to a table called tblscrapnotes.

When I print the report all pages 1 to 500 are printed.
How do I create a button that prints the current record
when each record is on its own page?
The tblScrapnote has a primary key SCRN_ID & forms the
scrap note number on the report.
Also, I have a form for viewing the scrap notes & would
like to print the same report from that form.

Any Help would be gratefully appreciated.
 
Ian,

You will need to add a Where Condition to the OpenReport method so that the
report shows only the information for the record displayed on your form.
Just insert one of the following samples in the Click event of a command
button:

' This works when your matching field is text
Dim strCriteria As String
strCriteria = "[SCRN_ID ] = " & Chr(34) & Me!SCRN_ID & Chr(34)
DoCmd.OpenReport "MyReport", acViewPreview, , strCriteria

' This works when your matching field is a number
Dim strCriteria As String
strCriteria = "[SCRN_ID ] = " & Me!SCRN_ID
DoCmd.OpenReport "MyReport", acViewPreview, , strCriteria

hth,
 
Cheryl,
Ok this seems fine, my next problem is that when I run it
i get a run time error 3211 & says.
The database engine could not lock table Scrap_Data
because it is already in use by another person or process.
not sure what is going on here ???

-----Original Message-----
Ian,

You will need to add a Where Condition to the OpenReport method so that the
report shows only the information for the record displayed on your form.
Just insert one of the following samples in the Click event of a command
button:

' This works when your matching field is text
Dim strCriteria As String
strCriteria = "[SCRN_ID ] = " & Chr(34) & Me!SCRN_ID & Chr(34)
DoCmd.OpenReport "MyReport", acViewPreview, , strCriteria

' This works when your matching field is a number
Dim strCriteria As String
strCriteria = "[SCRN_ID ] = " & Me!SCRN_ID
DoCmd.OpenReport "MyReport", acViewPreview, , strCriteria

hth,


--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


We have a report linked to a table called tblscrapnotes.

When I print the report all pages 1 to 500 are printed.
How do I create a button that prints the current record
when each record is on its own page?
The tblScrapnote has a primary key SCRN_ID & forms the
scrap note number on the report.
Also, I have a form for viewing the scrap notes & would
like to print the same report from that form.

Any Help would be gratefully appreciated.


.
 
Check out the Report's "Record Locks" property; and, if it is set to 'Yes',
change to 'No'.



--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


Cheryl,
Ok this seems fine, my next problem is that when I run it
i get a run time error 3211 & says.
The database engine could not lock table Scrap_Data
because it is already in use by another person or process.
not sure what is going on here ???

-----Original Message-----
Ian,

You will need to add a Where Condition to the OpenReport method so that the
report shows only the information for the record displayed on your form.
Just insert one of the following samples in the Click event of a command
button:

' This works when your matching field is text
Dim strCriteria As String
strCriteria = "[SCRN_ID ] = " & Chr(34) & Me!SCRN_ID & Chr(34)
DoCmd.OpenReport "MyReport", acViewPreview, , strCriteria

' This works when your matching field is a number
Dim strCriteria As String
strCriteria = "[SCRN_ID ] = " & Me!SCRN_ID
DoCmd.OpenReport "MyReport", acViewPreview, , strCriteria

hth,


--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


We have a report linked to a table called tblscrapnotes.

When I print the report all pages 1 to 500 are printed.
How do I create a button that prints the current record
when each record is on its own page?
The tblScrapnote has a primary key SCRN_ID & forms the
scrap note number on the report.
Also, I have a form for viewing the scrap notes & would
like to print the same report from that form.

Any Help would be gratefully appreciated.


.
 
Cool, That's done the trick
Thanx for the help
Regards,
Ian T :-))))))

-----Original Message-----
Check out the Report's "Record Locks" property; and, if it is set to 'Yes',
change to 'No'.



--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


Cheryl,
Ok this seems fine, my next problem is that when I run it
i get a run time error 3211 & says.
The database engine could not lock table Scrap_Data
because it is already in use by another person or process.
not sure what is going on here ???

-----Original Message-----
Ian,

You will need to add a Where Condition to the
OpenReport
method so that the
report shows only the information for the record displayed on your form.
Just insert one of the following samples in the Click event of a command
button:

' This works when your matching field is text
Dim strCriteria As String
strCriteria = "[SCRN_ID ] = " & Chr(34) & Me!
SCRN_ID
& Chr(34)
DoCmd.OpenReport "MyReport", acViewPreview, , strCriteria

' This works when your matching field is a number
Dim strCriteria As String
strCriteria = "[SCRN_ID ] = " & Me!SCRN_ID
DoCmd.OpenReport "MyReport", acViewPreview, , strCriteria

hth,


--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


We have a report linked to a table called tblscrapnotes.

When I print the report all pages 1 to 500 are printed.
How do I create a button that prints the current record
when each record is on its own page?
The tblScrapnote has a primary key SCRN_ID & forms the
scrap note number on the report.
Also, I have a form for viewing the scrap notes & would
like to print the same report from that form.

Any Help would be gratefully appreciated.




.


.
 
Great! Thanks for posting back with your results.

--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


Cool, That's done the trick
Thanx for the help
Regards,
Ian T :-))))))

-----Original Message-----
Check out the Report's "Record Locks" property; and, if it is set to 'Yes',
change to 'No'.



--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


Cheryl,
Ok this seems fine, my next problem is that when I run it
i get a run time error 3211 & says.
The database engine could not lock table Scrap_Data
because it is already in use by another person or process.
not sure what is going on here ???


-----Original Message-----
Ian,

You will need to add a Where Condition to the OpenReport
method so that the
report shows only the information for the record
displayed on your form.
Just insert one of the following samples in the Click
event of a command
button:

' This works when your matching field is text
Dim strCriteria As String
strCriteria = "[SCRN_ID ] = " & Chr(34) & Me! SCRN_ID
& Chr(34)
DoCmd.OpenReport "MyReport", acViewPreview, ,
strCriteria

' This works when your matching field is a number
Dim strCriteria As String
strCriteria = "[SCRN_ID ] = " & Me!SCRN_ID
DoCmd.OpenReport "MyReport", acViewPreview, ,
strCriteria

hth,


--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


"Ian Tranter" <anonymous@discussions.microsoft.com>
wrote in message
We have a report linked to a table called
tblscrapnotes.

When I print the report all pages 1 to 500 are printed.
How do I create a button that prints the current record
when each record is on its own page?
The tblScrapnote has a primary key SCRN_ID & forms the
scrap note number on the report.
Also, I have a form for viewing the scrap notes & would
like to print the same report from that form.

Any Help would be gratefully appreciated.




.


.
 
Back
Top