Skip to Content
0
Jun 13, 2009 at 02:15 PM

Printing preview prbolem

25 Views

Dear Experts,

I am trying to print preview using addon written in VB6 language in B1 2007 version but failed. Here is the part of source code that successful to use in printing preview in B1 2004 or 2005 but failed in current new version:

Public Sub Process_133 (ByVal FormUID As String, pVal As SAPbouiCOM.ItemEvent, BubbleEvent As Boolean)
 'Form AR Invoice process
  'hide  Sales Quotation and Sales Order
    If pVal.EventType = et_FORM_ACTIVATE Then
       Set oForm = SboApplication.Forms(pVal.FormUID)
       'hide sales order 
       Set oItem = oForm.Items.Item("36")
       oItem.Visible = False
       'hide sales quotation 
       Set oItem = oForm.Items.Item("37")
       oItem.Visible = False
    End If
    If pVal.EventType = et_FORM_LOAD Then
         If pVal.Before_Action = True Then
                Set oForm = SboApplication.Forms(pVal.FormUID)
                'hide sales order 
                Set oItem = oForm.Items.Item("36")
                oItem.Visible = False
                'hide sales quotation 
                Set oItem = oForm.Items.Item("37")
                oItem.Visible = False
                'BubbleEvent = True
         End If
           
                'Add button to show report about paid invoice based on customer code
                Set oItem = oForm.Items.Add("BtnPaid", it_BUTTON)
                oItem.Top = oForm.Items("138").Top
                oItem.Left = oForm.Items("138").Left + oForm.Items("138").Width
                oItem.Width = 80
                Set oButton = oItem.Specific
                oButton.Caption = "Paid Invoice"
           
                'Add button to show report about un paid invoice based on customer code
                Set oItem = oForm.Items.Add("BtnUnPaid", it_BUTTON)
                oItem.Top = oForm.Items("BtnPaid").Top
                oItem.Left = oForm.Items("BtnPaid").Left + oForm.Items("BtnPaid").Width + 5
                oItem.Width = 80
                Set oButton = oItem.Specific
                oButton.Caption = "UnPaid Invoice"
                
                'Set posting date field false
                Set oItem = oForm.Items("10")
                oItem.Enabled = False
                'BubbleEvent = False

Run-time error '-7012 (ffffe49c)':

ITem - already exists [66000-13]. Form Unique Id: F_151, Item Unique Id : BtnPaid and BtnUnPaid

Pls give help. I appreciate your help so much.

Rgd,

Steve