Solved

Printout a Subform from a Form

Posted on 1998-12-11
11
228 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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Any Way to Print an Import Spec? 3 31
Modal form 11 30
is Microsoft Access going to Die? 9 50
Trying to force an answer in a combobox 7 18
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…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

810 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