Solved

Printout a Subform from a Form

Posted on 1998-12-11
11
226 Views
Last Modified: 2006-11-17
I have a form with a Sub Form on it.  I want the Print button on the Form to print out the Selected Record on the Sub Form.  My print button must be on the Form that has the Sub form, I dont want the Print button on the Sub Form.  So the wizards arent going to work, or can they, or do you have some sample code.

Thank you,
From Rainy Seattle
Anthony
0
Comment
Question by:SemperParatus
  • 7
  • 2
  • 2
11 Comments
 
LVL 3

Expert Comment

by:tcurtin
ID: 1970706
select the record on the subform to print then create a report to accept a parameter from the subform. Use the where clause to define the criteria:

dim strCriteria as string
strCriteria = "[field]=" & forms!formname!subformcontrol.form![field]
docmd.openreport "reportName",acviewpreview,,strcriteria

0
 

Author Comment

by:SemperParatus
ID: 1970707
I dont want to use a report.  I like it better when the user only sees forms. The user has no access to the toolbars in Access and would like to keep that way.  I would like to see the user print the form.  

What I'm looking for is a MDI Form with a form with in it.  My Main form is acting as a MDI and my Subform is the form to be printed.  The print button is on the Main form (acting as a MDI).  

Personally I would just rather use VB6.0 but the budget doesnt allow a license.

Thanks for your input.  Sorry about getting back so late, but I was really sick from the Seattle weather.  Points adjusted +10
0
 

Author Comment

by:SemperParatus
ID: 1970708
Anyone Have an Idea?  
0
 
LVL 3

Expert Comment

by:tcurtin
ID: 1970709
How about:
1. Sendkeys "^P"  (alias for control + P) for print.
2. docmd.runcommand 'select the option for printing the form'

0
 

Author Comment

by:SemperParatus
ID: 1970710
Adjusted points to 200
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:SemperParatus
ID: 1970711
Adjusted points to 300
0
 

Author Comment

by:SemperParatus
ID: 1970712
Point increased to 300 from 115!  Still need some help if you could?

0
 
LVL 7

Accepted Solution

by:
Dedushka earned 300 total points
ID: 1970713
Hi, SemperParatus!

You can't print only subform from main form, i think.
But i can propose this solution:

1. Set background color for your mainform to "white".
2. Set "Display When" property for all controls on your mainform to "Screen only", for subform this property is "Always".
3. Attach to your command button cmdPrint this procedure:

Private Sub cmdPrint_Click()
    DoCmd.PrintOut
End Sub

When your click button on mainform, the mainform and subform will be printed (logicaly), but on the paper you see only subform, because mainform is white and all controls is not printed due to "Screen Only" setting.

Cheers.
Dedushka

0
 

Author Comment

by:SemperParatus
ID: 1970714
Damn! I am learning that Access is really for the Impaired Programers (no insult intended).  Just wish my office could afford a MS License for VB 6.0, cause Access SUCKS!  Things like my problem with this SubForm.  Plus, having to SetFocus to an object first before you can do anything with it also piss me off!  AAARRRRGGGGGGGG!!!!!!!!  

I am going to show the user the Form as a Sub Form, but I will have the Print buttons print out from another form or Report,

Thanks for all your insights.
0
 
LVL 7

Expert Comment

by:Dedushka
ID: 1970715
Be not afflicted, Anthony. Access is not the best program really. I am too going  to pass on VB6. Here only I know, that in VB6 will be not less problems, than in Access. But it is another history...

Try my offer, all the same it is any way out. Certainly it is a pity, that it's impossible to make all beautifully and as it would be desirable.

May be someone else can will offer a beautiful solution.

Regards,
Dedushka

0
 

Author Comment

by:SemperParatus
ID: 1970716
Thanks for the Help.

Sorry, I forgot about this thing.

Anthony
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now