Solved

Printout a Subform from a Form

Posted on 1998-12-11
11
229 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

696 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