×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Print two (2) pages with one 'Print' button - Access97

Print two (2) pages with one 'Print' button - Access97

Print two (2) pages with one 'Print' button - Access97

(OP)
Access97.  I have a form that uses a tab control to create two pages (two tabs).  
I have a 'Print' button on each page that, when clicked, will print the data on the page.
The user can tab to either page and then print the page.  I would like to set it up so that the user can print the current page or both pages with either of the Print buttons.
I would like to change the print buttons so that when clicked, the user would get a message box with two radio buttons plus an 'OK' button and a 'Cancel' button.
The radio buttons would be:
              1.  Print current page only
              2.  Print both pages

Currently, I have both Print buttons set up in 'Properties\Event\On Click\[Event Procedure] as follows:

Private Sub PrintButton_U_Click()
    On Error GoTo Err_Print_Click
    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.PrintOut acSelection
Exit_Print_Click:
    Exit Sub
Err_Print_Click:
    MsgBox Err.Description
    Resume Exit_Print_Click
End Sub

What must I do to make the desired change?  Thanks in advance.

Lou Marles


RE: Print two (2) pages with one 'Print' button - Access97

To start, you can't display radio buttons on a message box, so you'll have to create a mini form. Put the option buttons in a frame.

Your mini form will need to pass back two Boolean variables to your main form. One way to do this is to declare Public variables in the Declarations section of your main form's class module, and set them from your mini form's OK and Cancel button click events. The syntax for referring to them in the mini form is "Forms!MyMainForm.variablename". The first variable indicates whether the OK button was clicked, and the second indicates whether both pages are to be printed.

In your Print buttons' Click events, first display the mini form as a modal dialog box. When the mini form is closed, the two variables will be set. Your code should test whether OK was pressed first, and if so, print either the current page or both pages as specified. To print the non-current page, you'll have to bring it to the front in the tab control. To do this, just set the tab control's Value property to the page index of the page control you want to print. When you're done printing, you might want to switch the tab control back to the original page, for your user's convenience.

Rick Sprague

RE: Print two (2) pages with one 'Print' button - Access97

(OP)
Hi Rick,

Thanks for your response.  I will follow your method.  

Lou Marles

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close