Solved

Printout a Subform from a Form

Posted on 1998-12-11
11
230 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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
 

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
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.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

688 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