Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2002
    Location
    Charlotte NC
    Posts
    665

    Unanswered: Dificult Printing Issue

    I think that I may have put my self into a corner with my application, would like some other people's input here.

    I have an app that has a main form and in the main form there is a subform. The purpose of the main form is primaraly for the end user to make his/her criteria selection then launch a go button. After all the gyrations in the background the subform produces the output. In the sub form i have (for lack of space) created two customer fields, but only one is displayed at a time. There is a togle on the main form that togles the customer fileds off and on using this code:

    'Setting Customer View
    'Display Shippers
    If Forms![Form:_PCRKMS_Selection]![Customer_View] = 1 Then
    Forms![Form:_PCRKMS_Selection]![Subform:_PCRKMS_SELECTION_Data]![Sh_Concern].Visible = True
    Forms![Form:_PCRKMS_Selection]![Subform:_PCRKMS_SELECTION_Data]![Shipper_Concern_Label].Visible = True
    Forms![Form:_PCRKMS_Selection]![Subform:_PCRKMS_SELECTION_Data]![Cn_Concern].Visible = False
    Forms![Form:_PCRKMS_Selection]![Subform:_PCRKMS_SELECTION_Data]![Consignee_Concern_Label].Visible = False
    End If

    'Display Consignee
    If Forms![Form:_PCRKMS_Selection]![Customer_View] = 2 Then
    Forms![Form:_PCRKMS_Selection]![Subform:_PCRKMS_SELECTION_Data]![Sh_Concern].Visible = False
    Forms![Form:_PCRKMS_Selection]![Subform:_PCRKMS_SELECTION_Data]![Shipper_Concern_Label].Visible = False
    Forms![Form:_PCRKMS_Selection]![Subform:_PCRKMS_SELECTION_Data]![Cn_Concern].Visible = True
    Forms![Form:_PCRKMS_Selection]![Subform:_PCRKMS_SELECTION_Data]![Consignee_Concern_Label].Visible = True
    End If

    This also works like a champ no problem. The problem that I have run into is that when I set up the out of the box printing button using the code:

    Private Sub Print_sub_form_Click()
    On Error GoTo Err_Print_sub_form_Click

    Dim stDocName As String
    Dim MyForm As Form

    stDocName = "Subform:_PCRKMS_Selection_Data"
    Set MyForm = Screen.ActiveForm
    DoCmd.SelectObject acForm, stDocName, True
    DoCmd.PrintOut
    DoCmd.SelectObject acForm, MyForm.Name, False

    Exit_Print_sub_form_Click:
    Exit Sub

    Err_Print_sub_form_Click:
    MsgBox Err.Description
    Resume Exit_Print_sub_form_Click

    End Sub

    I only get one of the customer fields, no mater what the togle button has displayed. I suspect that the field shown may be the last field actve when the subform was saved. Any Ideas on how to get the print command to pring what is set currently as visable? Let me know Please.
    Jim

  2. #2
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    i think the case is more that it prints the form with the default settings ie the ones set during the forms creation, i'm affraid i haven't got the answer but i've traced simalar problems back to the fact that changing the settings is only for the current instance of the object and doesn't touch the settings of the real form even saving it wont change this.

    the only place i can suggest is changing the properties to match the instance you want to print with the onPrint event
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  3. #3
    Join Date
    Aug 2002
    Location
    Charlotte NC
    Posts
    665
    Originally posted by m.timoney
    i think the case is more that it prints the form with the default settings ie the ones set during the forms creation, i'm affraid i haven't got the answer but i've traced simalar problems back to the fact that changing the settings is only for the current instance of the object and doesn't touch the settings of the real form even saving it wont change this.

    the only place i can suggest is changing the properties to match the instance you want to print with the onPrint event

    What do you mean onprint event?
    Have no idea what that is but if its what i think it is i think that you are right
    Jim

  4. #4
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    not sure if it works on forms or just reports but the unHelp files say

    The Print event occurs after data in a report section is formatted for printing, but before the section is printed.
    Last edited by m.timoney; 11-28-02 at 05:39.
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •