Printing form without showing 'Print' command button

manthiralaya

Registered User.
Local time
Today, 14:25
Joined
Oct 14, 2010
Messages
13
Dear All,
This query is rearding Printing the forms.
I have a Form which contains some command buttons (say Command19_Table1 and Command19_Table2) and 'Print Form' button. I have coded for 'Print Form' button using DoCmd. I would like to print the form when I click 'Print Form', I would like to get the print without 'Print Form' button and 'Command19_Table2'. Ofcourse, I can use 'Report' but as my original project contains more than 200 text boxes. As in order to reduce the size of my database, is there any possiblities?
I have included the code. But it gives error "You can't hide a control that has a focus". That is true though.....is there trick to do so?
Thanks in advance.
Regards
Manthiralaya

Code:
Private Sub PrintFormButton_Click()
On Error GoTo Err_PrintFormButton_Click
    PrintFormButton.Visible = False
    DoCmd.PrintOut
    PrintFormButton.Visible = True
Exit_PrintFormButton_Click:
    Exit Sub
Err_PrintFormButton_Click:
    MsgBox Err.Description
    Resume Exit_PrintFormButton_Click
End Sub
 
Set focus to another control before you hide the commandbutton

JR
 
Thanks JANR......It works.....C U later....
Regards,
manthiralaya
 

Users who are viewing this thread

Back
Top Bottom