A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Printing a single record from a tab control subform



 
 
Thread Tools Display Modes
  #11  
Old April 13th, 2010, 04:37 AM posted to microsoft.public.access.gettingstarted
Duane Hookom[_4_]
external usenet poster
 
Posts: 316
Default Printing a single record from a tab control subform

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" wrote in message
...
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" wrote:

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" wrote in message
...
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" wrote:

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" wrote in message
...
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 "strWhe " & strWhere
MsgBox "strWhe " & strWhere
DoCmd.OpenReport "R1-1 GPS_GeneralInfo", acPreview, , strWhere

End Sub


--
Duane Hookom
MS Access MVP


"forest8" wrote in message
...
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" wrote in message
...
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.


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:04 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.