From: forest8 on
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.


From: Duane Hookom on
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


"forest8" <forest8(a)discussions.microsoft.com> wrote in message
news:C40D9BDE-5071-4CAA-92C6-18BE8DDF67B1(a)microsoft.com...
> 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.
>
>
From: forest8 on
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" wrote:

> 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
>
>
> "forest8" <forest8(a)discussions.microsoft.com> wrote in message
> news:C40D9BDE-5071-4CAA-92C6-18BE8DDF67B1(a)microsoft.com...
> > 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.
> >
> >
From: Duane Hookom on
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" <forest8(a)discussions.microsoft.com> wrote in message
news:09A72E68-6E87-4C60-BB51-BA3B6AFD4ED5(a)microsoft.com...
> 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" wrote:
>
>> 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
>>
>>
>> "forest8" <forest8(a)discussions.microsoft.com> wrote in message
>> news:C40D9BDE-5071-4CAA-92C6-18BE8DDF67B1(a)microsoft.com...
>> > 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.
>> >
>> >
From: forest8 on
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" wrote:

> 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" <forest8(a)discussions.microsoft.com> wrote in message
> news:09A72E68-6E87-4C60-BB51-BA3B6AFD4ED5(a)microsoft.com...
> > 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" wrote:
> >
> >> 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
> >>
> >>
> >> "forest8" <forest8(a)discussions.microsoft.com> wrote in message
> >> news:C40D9BDE-5071-4CAA-92C6-18BE8DDF67B1(a)microsoft.com...
> >> > 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.
> >> >
> >> >