Printing a single form which has tabs

F

forest8

Hello

I have created a form in which I am inputting survey data.

There are 5 tab pages in this form.

I want to print all 5 tabbed pages. I want to create a button called "Print
Record". When one clicks on this button, I want it to print all 5 pages.

At the moment, I print one page. Then tab to the second page and print, and
so.

Can I set it so that one you click on print, you can decide on which page
you want to print or print all five pages?

Can I do this in code? If this isn't the right section, please direct me.

Thank you in advance.
 
J

Jack Leach

Generally speaking, you would use a report formatted for the desired data to
do the printing... forms can be printed but arent exactly ideal.

However, there is a way to programmatically set the selected tab page, so
you can run a button's click event that will go to the first tab, print, go
to the second tab, print, go to the third tab, print, etc etc.

Tab pages can be selected by supplying an index value to the main tab
control. If the tab control (not the pages) is called tabMain, you might use
something like this (tab page indexes start as 0, so if you have 3 tabs, the
indexes for them will be 0, 1 and 2)...

Me.tabMain = 0


So, knowing how to select a particular tab page, you can then include your
Print command in the same procedure behind the OnClick of a button... it
might look something like this:

Private Sub SomeButton_Click()
Me.tabMain = 0
DoCmd.PrintOut
Me.tabMain = 1
DoCmd.PrintOut
Me.tabMain = 2
DoCmd.PrintOut
End Sub

You can make the above code a bit more elegant but looping the count of tab
pages... then you won't have to manually go in and change the code if you add
or remove a tab page...

Private Sub btnPrintTabs_Click()
Dim i as Integer
For i = 0 To Me.tabMain.Count - 1
Me.tabMain = i
DoCmd.PrintOut
Next i
End Sub


To have the user select a tab to print, you will need some sort of interface
for them... maybe a combo dropdown that lists the tab pages. You can then
reference the value of the combo to print the selected page.


hth
--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
J

John W. Vinson

Hello

I have created a form in which I am inputting survey data.

There are 5 tab pages in this form.

I want to print all 5 tabbed pages. I want to create a button called "Print
Record". When one clicks on this button, I want it to print all 5 pages.

At the moment, I print one page. Then tab to the second page and print, and
so.

Can I set it so that one you click on print, you can decide on which page
you want to print or print all five pages?

Can I do this in code? If this isn't the right section, please direct me.

Thank you in advance.

Forms aren't really designed for printing, and don't work very well for it. In
particular, a tab control is designed to arrange data *on a screen*, not on
paper.

Create a Report based on the same tables (or queries) as your form... and
print THAT.

One concern: do you have five tabs because your Table has as many fields as
there are questions in your survey? If so, you have fallen into a very common
trap: "the wide-flat table". For a flexible survey design see

Duane Hookum's "At Your Survey":
http://www.rogersaccesslibrary.com/forum/forum_posts.asp?TID=3

and/or

Roger Carlson's Training Registration database:
http://www.rogersaccesslibrary.com/download3.asp?SampleName=TrainingRegistration.mdb
 
F

forest8

Thanks for your help.

Yes, I've looked at Duane's survey design. Unfortunately the people who will
be inputting the survey are not computer savvy and if it "looks" different
from the peper copy that they're using -- they would freak out. My forms look
like the paper format so they feel comfortable with it.

Since I didn't want to re-invent the wheel per se, I made the tabs of the
form look like their survey.

I know it's not the best method but it would suffice for these users.
 
F

forest8

This looks like what I need. Since I'm new to this part of Access, where
would I put this code. Within the code for the "Print: button?

Thanks
Forest
 
J

John W. Vinson

Thanks for your help.

Yes, I've looked at Duane's survey design. Unfortunately the people who will
be inputting the survey are not computer savvy and if it "looks" different
from the peper copy that they're using -- they would freak out. My forms look
like the paper format so they feel comfortable with it.

Since I didn't want to re-invent the wheel per se, I made the tabs of the
form look like their survey.

I know it's not the best method but it would suffice for these users.

That's what I suspected. Surveys are a pain, for this very reason!

One (somewhat laborious) possibility is to divorce the form design from the
table design. You could use a properly normalized tall-thin *table*, with an
unbound form; the form could have a command button or other appropriate code
to migrate the values from the 250 checkboxes or textboxes or combos into 250
records in an answers table. This would at least give you data which can be
searched and reported more easily than the (very rigid inflexible) wide-flat
structure.
 
F

forest8

Hi

I tried both methods of writing the code for printing but I'm having
problems with either version.

I tried this syntax:


Main is the tab control on one of my forms.

Private Sub_Print_Form_Click()
Me.Main = 0
DoCmd.PrintOut
Me.Main = 1
DoCmd.PrintOut
Me.Main = 0
DoCmd.PrintOut

End Sub

I get a

Rub-time error '2212':
Microsoft Office Access cannot print your object.

When I print other forms, I don't have this problem.



When I tried the second method, it appears that nothing gets printed. How
do I fix this?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top