Printing a single record from a tab control subform

  • Thread starter Thread starter forest8
  • Start date Start date
F

forest8

Hi

I have created a Case Management Database of students. It consists of a main
form
and a subform. The main form consists of information that must be seen at
all times. since it consists of information about each student.

The subform consists of a tab control. There is a different subject on each
page of the tab contol, e.g. General Information, Current Student
Information, etc.

I need to print out the mainform and subforms so I created reports for each
subform in my tab control.

I want to put a "Print" button on each page of my tabcontrol so that when
clicked, that specific report for that particular record is printed?

The thing is that my "Print" button does not work. That is, when I click on
it, nothing happens.

How do I fix it so that it prints that report for that particular record?

Thank you for your help in advance.
 
What makes you think your "Print" button should work? How did you create it?
Did you use the wizard? What is the code?
 
Hi

This is the code for the print function as an Event procedure. I'm not sure
what I'm missing.

Private Sub Print_Click()

Dim strDocName As String
Dim strWhere As String
strDocName = "R1-1 GPS_GeneralInfo"
strWhere = "[ID_General] = " & Me.[ID_General]
DoCmd.OpenReport "R1-1 GPS_GeneralInfo", acPreview, , strWhere

End Sub

The name of the report is R1-1 GPS_GeneralInfo
The primary key of the subform is "ID_General"

The main form is called GPS. One of the subforms in the tabcontrol is called
General.

I saved the GPS form and General form as reports (by using save as). Then I
created the report by using the GPS form as the report and the General form
as the subreport. The Masterlink is GPSID and the ChildLinkID is GPSID_FK.

The form doesn't have the primary key in it. It's just in the Table called
T_General.

I should also mention that the Print button with the Click event is on the
subform in the tabcontrol.

If I can get this one report to work, I can use the same logic and fix all
the other reports in my database.

Thank you.
 
Learn the basics of trouble-shooting. Try add a msgbox, debug.Print, or
breakpoint to your code so you know if the code is being run:
Also, always provide the significant data types. Is ID_General text or
numeric?

Private Sub Print_Click()

Dim strDocName As String
Dim strWhere As String
strDocName = "R1-1 GPS_GeneralInfo"
strWhere = "[ID_General] = " & Me.[ID_General]
debug.print "strWhere: " & strWhere
MsgBox "strWhere: " & strWhere
DoCmd.OpenReport "R1-1 GPS_GeneralInfo", acPreview, , strWhere

End Sub


--
Duane Hookom
MS Access MVP


forest8 said:
Hi

This is the code for the print function as an Event procedure. I'm not
sure
what I'm missing.

Private Sub Print_Click()

Dim strDocName As String
Dim strWhere As String
strDocName = "R1-1 GPS_GeneralInfo"
strWhere = "[ID_General] = " & Me.[ID_General]
DoCmd.OpenReport "R1-1 GPS_GeneralInfo", acPreview, , strWhere

End Sub

The name of the report is R1-1 GPS_GeneralInfo
The primary key of the subform is "ID_General"

The main form is called GPS. One of the subforms in the tabcontrol is
called
General.

I saved the GPS form and General form as reports (by using save as). Then
I
created the report by using the GPS form as the report and the General
form
as the subreport. The Masterlink is GPSID and the ChildLinkID is GPSID_FK.

The form doesn't have the primary key in it. It's just in the Table called
T_General.

I should also mention that the Print button with the Click event is on the
subform in the tabcontrol.

If I can get this one report to work, I can use the same logic and fix all
the other reports in my database.

Thank you.


Duane Hookom said:
What makes you think your "Print" button should work? How did you create
it?
Did you use the wizard? What is the code?
 
The primary keys are Autonumbers.

The Master and child fields are text. Is it possible to use the non-primary
keys as the basis of the "Where" statement?

Thanks

Duane Hookom said:
Learn the basics of trouble-shooting. Try add a msgbox, debug.Print, or
breakpoint to your code so you know if the code is being run:
Also, always provide the significant data types. Is ID_General text or
numeric?

Private Sub Print_Click()

Dim strDocName As String
Dim strWhere As String
strDocName = "R1-1 GPS_GeneralInfo"
strWhere = "[ID_General] = " & Me.[ID_General]
debug.print "strWhere: " & strWhere
MsgBox "strWhere: " & strWhere
DoCmd.OpenReport "R1-1 GPS_GeneralInfo", acPreview, , strWhere

End Sub


--
Duane Hookom
MS Access MVP


forest8 said:
Hi

This is the code for the print function as an Event procedure. I'm not
sure
what I'm missing.

Private Sub Print_Click()

Dim strDocName As String
Dim strWhere As String
strDocName = "R1-1 GPS_GeneralInfo"
strWhere = "[ID_General] = " & Me.[ID_General]
DoCmd.OpenReport "R1-1 GPS_GeneralInfo", acPreview, , strWhere

End Sub

The name of the report is R1-1 GPS_GeneralInfo
The primary key of the subform is "ID_General"

The main form is called GPS. One of the subforms in the tabcontrol is
called
General.

I saved the GPS form and General form as reports (by using save as). Then
I
created the report by using the GPS form as the report and the General
form
as the subreport. The Masterlink is GPSID and the ChildLinkID is GPSID_FK.

The form doesn't have the primary key in it. It's just in the Table called
T_General.

I should also mention that the Print button with the Click event is on the
subform in the tabcontrol.

If I can get this one report to work, I can use the same logic and fix all
the other reports in my database.

Thank you.


Duane Hookom said:
What makes you think your "Print" button should work? How did you create
it?
Did you use the wizard? What is the code?


--
Duane Hookom
MS Access MVP


Hi

I have created a Case Management Database of students. It consists of a
main
form
and a subform. The main form consists of information that must be seen
at
all times. since it consists of information about each student.

The subform consists of a tab control. There is a different subject on
each
page of the tab contol, e.g. General Information, Current Student
Information, etc.

I need to print out the mainform and subforms so I created reports for
each
subform in my tab control.

I want to put a "Print" button on each page of my tabcontrol so that
when
clicked, that specific report for that particular record is printed?

The thing is that my "Print" button does not work. That is, when I
click
on
it, nothing happens.

How do I fix it so that it prints that report for that particular
record?

Thank you for your help in advance.
 
You can use a value from any field in your report's record source. Use a zip
code or city if you like. Keep in mind your report will include all records
that match. It's like going to a car dealer to buy a car. You can ask for
cars where the color equals red or you can ask for a car where the gas
mileage is better than 25 mpg. If you have visited before and bought a car,
you can ask for the car that matches your VIN number.

--
Duane Hookom
MS Access MVP


forest8 said:
The primary keys are Autonumbers.

The Master and child fields are text. Is it possible to use the
non-primary
keys as the basis of the "Where" statement?

Thanks

Duane Hookom said:
Learn the basics of trouble-shooting. Try add a msgbox, debug.Print, or
breakpoint to your code so you know if the code is being run:
Also, always provide the significant data types. Is ID_General text or
numeric?

Private Sub Print_Click()

Dim strDocName As String
Dim strWhere As String
strDocName = "R1-1 GPS_GeneralInfo"
strWhere = "[ID_General] = " & Me.[ID_General]
debug.print "strWhere: " & strWhere
MsgBox "strWhere: " & strWhere
DoCmd.OpenReport "R1-1 GPS_GeneralInfo", acPreview, , strWhere

End Sub


--
Duane Hookom
MS Access MVP


forest8 said:
Hi

This is the code for the print function as an Event procedure. I'm not
sure
what I'm missing.

Private Sub Print_Click()

Dim strDocName As String
Dim strWhere As String
strDocName = "R1-1 GPS_GeneralInfo"
strWhere = "[ID_General] = " & Me.[ID_General]
DoCmd.OpenReport "R1-1 GPS_GeneralInfo", acPreview, , strWhere

End Sub

The name of the report is R1-1 GPS_GeneralInfo
The primary key of the subform is "ID_General"

The main form is called GPS. One of the subforms in the tabcontrol is
called
General.

I saved the GPS form and General form as reports (by using save as).
Then
I
created the report by using the GPS form as the report and the General
form
as the subreport. The Masterlink is GPSID and the ChildLinkID is
GPSID_FK.

The form doesn't have the primary key in it. It's just in the Table
called
T_General.

I should also mention that the Print button with the Click event is on
the
subform in the tabcontrol.

If I can get this one report to work, I can use the same logic and fix
all
the other reports in my database.

Thank you.


:

What makes you think your "Print" button should work? How did you
create
it?
Did you use the wizard? What is the code?


--
Duane Hookom
MS Access MVP


Hi

I have created a Case Management Database of students. It consists
of a
main
form
and a subform. The main form consists of information that must be
seen
at
all times. since it consists of information about each student.

The subform consists of a tab control. There is a different subject
on
each
page of the tab contol, e.g. General Information, Current Student
Information, etc.

I need to print out the mainform and subforms so I created reports
for
each
subform in my tab control.

I want to put a "Print" button on each page of my tabcontrol so that
when
clicked, that specific report for that particular record is printed?

The thing is that my "Print" button does not work. That is, when I
click
on
it, nothing happens.

How do I fix it so that it prints that report for that particular
record?

Thank you for your help in advance.
 
Hi there

I'm having another issue with this. As I mentioned earlier, my report is
based on a report and subreport.

When I see my report for a single record, it's only showing the report
portion of my document. I don't see the subreport.

Also, I'm getting an "Enter Parameter Value" error wbere I'm asked to enter
a value for the ID_General field. I've checked my tables and forms and the
fields I am using are the same as in my macro.

Thank you again.



Duane Hookom said:
You can use a value from any field in your report's record source. Use a zip
code or city if you like. Keep in mind your report will include all records
that match. It's like going to a car dealer to buy a car. You can ask for
cars where the color equals red or you can ask for a car where the gas
mileage is better than 25 mpg. If you have visited before and bought a car,
you can ask for the car that matches your VIN number.

--
Duane Hookom
MS Access MVP


forest8 said:
The primary keys are Autonumbers.

The Master and child fields are text. Is it possible to use the
non-primary
keys as the basis of the "Where" statement?

Thanks

Duane Hookom said:
Learn the basics of trouble-shooting. Try add a msgbox, debug.Print, or
breakpoint to your code so you know if the code is being run:
Also, always provide the significant data types. Is ID_General text or
numeric?

Private Sub Print_Click()

Dim strDocName As String
Dim strWhere As String
strDocName = "R1-1 GPS_GeneralInfo"
strWhere = "[ID_General] = " & Me.[ID_General]
debug.print "strWhere: " & strWhere
MsgBox "strWhere: " & strWhere
DoCmd.OpenReport "R1-1 GPS_GeneralInfo", acPreview, , strWhere

End Sub


--
Duane Hookom
MS Access MVP


Hi

This is the code for the print function as an Event procedure. I'm not
sure
what I'm missing.

Private Sub Print_Click()

Dim strDocName As String
Dim strWhere As String
strDocName = "R1-1 GPS_GeneralInfo"
strWhere = "[ID_General] = " & Me.[ID_General]
DoCmd.OpenReport "R1-1 GPS_GeneralInfo", acPreview, , strWhere

End Sub

The name of the report is R1-1 GPS_GeneralInfo
The primary key of the subform is "ID_General"

The main form is called GPS. One of the subforms in the tabcontrol is
called
General.

I saved the GPS form and General form as reports (by using save as).
Then
I
created the report by using the GPS form as the report and the General
form
as the subreport. The Masterlink is GPSID and the ChildLinkID is
GPSID_FK.

The form doesn't have the primary key in it. It's just in the Table
called
T_General.

I should also mention that the Print button with the Click event is on
the
subform in the tabcontrol.

If I can get this one report to work, I can use the same logic and fix
all
the other reports in my database.

Thank you.


:

What makes you think your "Print" button should work? How did you
create
it?
Did you use the wizard? What is the code?


--
Duane Hookom
MS Access MVP


Hi

I have created a Case Management Database of students. It consists
of a
main
form
and a subform. The main form consists of information that must be
seen
at
all times. since it consists of information about each student.

The subform consists of a tab control. There is a different subject
on
each
page of the tab contol, e.g. General Information, Current Student
Information, etc.

I need to print out the mainform and subforms so I created reports
for
each
subform in my tab control.

I want to put a "Print" button on each page of my tabcontrol so that
when
clicked, that specific report for that particular record is printed?

The thing is that my "Print" button does not work. That is, when I
click
on
it, nothing happens.

How do I fix it so that it prints that report for that particular
record?

Thank you for your help in advance.
 
What values do you have entered into the Link Master/Child properties? Can
you see the ID_General field in the record sources of the main and
subreports?

--
Duane Hookom
MS Access MVP


forest8 said:
Hi there

I'm having another issue with this. As I mentioned earlier, my report is
based on a report and subreport.

When I see my report for a single record, it's only showing the report
portion of my document. I don't see the subreport.

Also, I'm getting an "Enter Parameter Value" error wbere I'm asked to
enter
a value for the ID_General field. I've checked my tables and forms and the
fields I am using are the same as in my macro.

Thank you again.



Duane Hookom said:
You can use a value from any field in your report's record source. Use a
zip
code or city if you like. Keep in mind your report will include all
records
that match. It's like going to a car dealer to buy a car. You can ask for
cars where the color equals red or you can ask for a car where the gas
mileage is better than 25 mpg. If you have visited before and bought a
car,
you can ask for the car that matches your VIN number.

--
Duane Hookom
MS Access MVP


forest8 said:
The primary keys are Autonumbers.

The Master and child fields are text. Is it possible to use the
non-primary
keys as the basis of the "Where" statement?

Thanks

:

Learn the basics of trouble-shooting. Try add a msgbox, debug.Print,
or
breakpoint to your code so you know if the code is being run:
Also, always provide the significant data types. Is ID_General text or
numeric?

Private Sub Print_Click()

Dim strDocName As String
Dim strWhere As String
strDocName = "R1-1 GPS_GeneralInfo"
strWhere = "[ID_General] = " & Me.[ID_General]
debug.print "strWhere: " & strWhere
MsgBox "strWhere: " & strWhere
DoCmd.OpenReport "R1-1 GPS_GeneralInfo", acPreview, , strWhere

End Sub


--
Duane Hookom
MS Access MVP


Hi

This is the code for the print function as an Event procedure. I'm
not
sure
what I'm missing.

Private Sub Print_Click()

Dim strDocName As String
Dim strWhere As String
strDocName = "R1-1 GPS_GeneralInfo"
strWhere = "[ID_General] = " & Me.[ID_General]
DoCmd.OpenReport "R1-1 GPS_GeneralInfo", acPreview, , strWhere

End Sub

The name of the report is R1-1 GPS_GeneralInfo
The primary key of the subform is "ID_General"

The main form is called GPS. One of the subforms in the tabcontrol
is
called
General.

I saved the GPS form and General form as reports (by using save as).
Then
I
created the report by using the GPS form as the report and the
General
form
as the subreport. The Masterlink is GPSID and the ChildLinkID is
GPSID_FK.

The form doesn't have the primary key in it. It's just in the Table
called
T_General.

I should also mention that the Print button with the Click event is
on
the
subform in the tabcontrol.

If I can get this one report to work, I can use the same logic and
fix
all
the other reports in my database.

Thank you.


:

What makes you think your "Print" button should work? How did you
create
it?
Did you use the wizard? What is the code?


--
Duane Hookom
MS Access MVP


Hi

I have created a Case Management Database of students. It
consists
of a
main
form
and a subform. The main form consists of information that must be
seen
at
all times. since it consists of information about each student.

The subform consists of a tab control. There is a different
subject
on
each
page of the tab contol, e.g. General Information, Current Student
Information, etc.

I need to print out the mainform and subforms so I created
reports
for
each
subform in my tab control.

I want to put a "Print" button on each page of my tabcontrol so
that
when
clicked, that specific report for that particular record is
printed?

The thing is that my "Print" button does not work. That is, when
I
click
on
it, nothing happens.

How do I fix it so that it prints that report for that particular
record?

Thank you for your help in advance.
 
The value in the Link Master/Child properties is the Students_ID.

If I don't try to print a single record, I could see the report/subreport.
When I try to isolate a single record, the report section only prints.



Duane Hookom said:
What values do you have entered into the Link Master/Child properties? Can
you see the ID_General field in the record sources of the main and
subreports?

--
Duane Hookom
MS Access MVP


forest8 said:
Hi there

I'm having another issue with this. As I mentioned earlier, my report is
based on a report and subreport.

When I see my report for a single record, it's only showing the report
portion of my document. I don't see the subreport.

Also, I'm getting an "Enter Parameter Value" error wbere I'm asked to
enter
a value for the ID_General field. I've checked my tables and forms and the
fields I am using are the same as in my macro.

Thank you again.



Duane Hookom said:
You can use a value from any field in your report's record source. Use a
zip
code or city if you like. Keep in mind your report will include all
records
that match. It's like going to a car dealer to buy a car. You can ask for
cars where the color equals red or you can ask for a car where the gas
mileage is better than 25 mpg. If you have visited before and bought a
car,
you can ask for the car that matches your VIN number.

--
Duane Hookom
MS Access MVP


The primary keys are Autonumbers.

The Master and child fields are text. Is it possible to use the
non-primary
keys as the basis of the "Where" statement?

Thanks

:

Learn the basics of trouble-shooting. Try add a msgbox, debug.Print,
or
breakpoint to your code so you know if the code is being run:
Also, always provide the significant data types. Is ID_General text or
numeric?

Private Sub Print_Click()

Dim strDocName As String
Dim strWhere As String
strDocName = "R1-1 GPS_GeneralInfo"
strWhere = "[ID_General] = " & Me.[ID_General]
debug.print "strWhere: " & strWhere
MsgBox "strWhere: " & strWhere
DoCmd.OpenReport "R1-1 GPS_GeneralInfo", acPreview, , strWhere

End Sub


--
Duane Hookom
MS Access MVP


Hi

This is the code for the print function as an Event procedure. I'm
not
sure
what I'm missing.

Private Sub Print_Click()

Dim strDocName As String
Dim strWhere As String
strDocName = "R1-1 GPS_GeneralInfo"
strWhere = "[ID_General] = " & Me.[ID_General]
DoCmd.OpenReport "R1-1 GPS_GeneralInfo", acPreview, , strWhere

End Sub

The name of the report is R1-1 GPS_GeneralInfo
The primary key of the subform is "ID_General"

The main form is called GPS. One of the subforms in the tabcontrol
is
called
General.

I saved the GPS form and General form as reports (by using save as).
Then
I
created the report by using the GPS form as the report and the
General
form
as the subreport. The Masterlink is GPSID and the ChildLinkID is
GPSID_FK.

The form doesn't have the primary key in it. It's just in the Table
called
T_General.

I should also mention that the Print button with the Click event is
on
the
subform in the tabcontrol.

If I can get this one report to work, I can use the same logic and
fix
all
the other reports in my database.

Thank you.


:

What makes you think your "Print" button should work? How did you
create
it?
Did you use the wizard? What is the code?


--
Duane Hookom
MS Access MVP


Hi

I have created a Case Management Database of students. It
consists
of a
main
form
and a subform. The main form consists of information that must be
seen
at
all times. since it consists of information about each student.

The subform consists of a tab control. There is a different
subject
on
each
page of the tab contol, e.g. General Information, Current Student
Information, etc.

I need to print out the mainform and subforms so I created
reports
for
each
subform in my tab control.

I want to put a "Print" button on each page of my tabcontrol so
that
when
clicked, that specific report for that particular record is
printed?

The thing is that my "Print" button does not work. That is, when
I
click
on
it, nothing happens.

How do I fix it so that it prints that report for that particular
record?

Thank you for your help in advance.
 
If you want to print the report for a single student then why do you use:
strWhere = "[ID_General] = " & Me.[ID_General]
rather than
strWhere = "[Students_ID] = " & Me.[Students_ID]

I assume Students_ID is a numeric field that identifies the exact record you
want to use to filter the report.

--
Duane Hookom
MS Access MVP


forest8 said:
The value in the Link Master/Child properties is the Students_ID.

If I don't try to print a single record, I could see the report/subreport.
When I try to isolate a single record, the report section only prints.



Duane Hookom said:
What values do you have entered into the Link Master/Child properties?
Can
you see the ID_General field in the record sources of the main and
subreports?

--
Duane Hookom
MS Access MVP


forest8 said:
Hi there

I'm having another issue with this. As I mentioned earlier, my report
is
based on a report and subreport.

When I see my report for a single record, it's only showing the report
portion of my document. I don't see the subreport.

Also, I'm getting an "Enter Parameter Value" error wbere I'm asked to
enter
a value for the ID_General field. I've checked my tables and forms and
the
fields I am using are the same as in my macro.

Thank you again.



:

You can use a value from any field in your report's record source. Use
a
zip
code or city if you like. Keep in mind your report will include all
records
that match. It's like going to a car dealer to buy a car. You can ask
for
cars where the color equals red or you can ask for a car where the gas
mileage is better than 25 mpg. If you have visited before and bought a
car,
you can ask for the car that matches your VIN number.

--
Duane Hookom
MS Access MVP


The primary keys are Autonumbers.

The Master and child fields are text. Is it possible to use the
non-primary
keys as the basis of the "Where" statement?

Thanks

:

Learn the basics of trouble-shooting. Try add a msgbox,
debug.Print,
or
breakpoint to your code so you know if the code is being run:
Also, always provide the significant data types. Is ID_General text
or
numeric?

Private Sub Print_Click()

Dim strDocName As String
Dim strWhere As String
strDocName = "R1-1 GPS_GeneralInfo"
strWhere = "[ID_General] = " & Me.[ID_General]
debug.print "strWhere: " & strWhere
MsgBox "strWhere: " & strWhere
DoCmd.OpenReport "R1-1 GPS_GeneralInfo", acPreview, , strWhere

End Sub


--
Duane Hookom
MS Access MVP


Hi

This is the code for the print function as an Event procedure.
I'm
not
sure
what I'm missing.

Private Sub Print_Click()

Dim strDocName As String
Dim strWhere As String
strDocName = "R1-1 GPS_GeneralInfo"
strWhere = "[ID_General] = " & Me.[ID_General]
DoCmd.OpenReport "R1-1 GPS_GeneralInfo", acPreview, , strWhere

End Sub

The name of the report is R1-1 GPS_GeneralInfo
The primary key of the subform is "ID_General"

The main form is called GPS. One of the subforms in the
tabcontrol
is
called
General.

I saved the GPS form and General form as reports (by using save
as).
Then
I
created the report by using the GPS form as the report and the
General
form
as the subreport. The Masterlink is GPSID and the ChildLinkID is
GPSID_FK.

The form doesn't have the primary key in it. It's just in the
Table
called
T_General.

I should also mention that the Print button with the Click event
is
on
the
subform in the tabcontrol.

If I can get this one report to work, I can use the same logic
and
fix
all
the other reports in my database.

Thank you.


:

What makes you think your "Print" button should work? How did
you
create
it?
Did you use the wizard? What is the code?


--
Duane Hookom
MS Access MVP


Hi

I have created a Case Management Database of students. It
consists
of a
main
form
and a subform. The main form consists of information that must
be
seen
at
all times. since it consists of information about each
student.

The subform consists of a tab control. There is a different
subject
on
each
page of the tab contol, e.g. General Information, Current
Student
Information, etc.

I need to print out the mainform and subforms so I created
reports
for
each
subform in my tab control.

I want to put a "Print" button on each page of my tabcontrol
so
that
when
clicked, that specific report for that particular record is
printed?

The thing is that my "Print" button does not work. That is,
when
I
click
on
it, nothing happens.

How do I fix it so that it prints that report for that
particular
record?

Thank you for your help in advance.
 
Back
Top