VERSION 5.00
Begin VB.Form frmPrintSPA 
   Caption         =   "Print preview"
   ClientHeight    =   8925
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   12930
   LinkTopic       =   "Form2"
   ScaleHeight     =   8925
   ScaleWidth      =   12930
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows Default
End
Attribute VB_Name = "frmPrintSPA"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Const SEP1 As String = "®"

Private WithEvents mo_SPA_Preview As SPA_Preview
Attribute mo_SPA_Preview.VB_VarHelpID = -1

Public Property Get Initialized() As Boolean
    Initialized = mo_SPA_Preview.Initialized
End Property

Public Property Let U_Code(ByVal al_U_code As Long)
On Error GoTo ErrHandler
    mo_SPA_Preview.U_Code = al_U_code
    Exit Property
ErrHandler:
    Call ErrorHandler(Name & ".U_Code(Let)")
End Property

Public Property Let LoginName(ByVal as_LoginName As String)
On Error GoTo ErrHandler
    mo_SPA_Preview.LoginName = as_LoginName
    Exit Property
ErrHandler:
    Call ErrorHandler(Name & ".LoginName(Let)")
End Property

Public Property Let Language_Code(as_Language_Code As String)
On Error GoTo ErrHandler
    mo_SPA_Preview.Language_Code = as_Language_Code
    Exit Property
ErrHandler:
    Call ErrorHandler(Name & ".Language(Let)")
End Property

Public Property Let CT_Code(as_CT_Code As String)
On Error GoTo ErrHandler
    mo_SPA_Preview.CT_Code = as_CT_Code
    Exit Property
ErrHandler:
    Call ErrorHandler(Name & ".Language(Let)")
End Property

Public Property Let EMail(as_EMail As String)
On Error GoTo ErrHandler
    mo_SPA_Preview.EMail = as_EMail
    Exit Property
ErrHandler:
    Call ErrorHandler(Name & ".EMail(Let)")
End Property


Public Property Set DB(ByRef ao_DB As ArmDb)
On Error GoTo ErrHandler
    Set mo_SPA_Preview.DB = ao_DB
    Exit Property
ErrHandler:
    Call ErrorHandler(Name & ".Db(Set)")
End Property

Public Sub Run(ByVal ae_ScrMode As SPA_Mode, ByVal av_Key As Variant)
On Error GoTo ErrHandler
    If mo_SPA_Preview.Run(ae_ScrMode, av_Key) Then
        Dim ll_oldCursor As Long
        ll_oldCursor = Screen.MousePointer
        Screen.MousePointer = vbDefault
        Call Me.show(vbModal)
        Screen.MousePointer = ll_oldCursor
    End If
    Exit Sub
ErrHandler:
    Call ErrorHandler(Name & ".Run")
End Sub

Public Function InitForm() As Boolean
On Error GoTo ErrHandler
    Set mo_SPA_Preview = Controls.Add(C_ProgID & ".SPA_Preview", "mo_SPA_Preview", Me)
    InitForm = True
    Exit Function
ErrHandler:
    Call ErrorHandler(Name & ".InitForm()")
End Function

Public Sub Load_A_Com()
Dim lo_Control As Object
On Error GoTo ErrHandler
    Call mo_SPA_Preview.Load_A_Com
    Caption = mo_SPA_Preview.Title
    Call mo_SPA_Preview.MoveC(0, 0, Width, Height)
    mo_SPA_Preview.VisibleC = True
    Exit Sub
ErrHandler:
    Call ErrorHandler(Name & ".Load_A_Com()")
End Sub

Public Sub Unload_A_Com()
Dim lo_Control As Object
On Error GoTo ErrHandler
    Call mo_SPA_Preview.Unload_A_Com
    Set mo_SPA_Preview = Nothing
    Exit Sub
ErrHandler:
    Call ErrorHandler(Name & ".Unload_A_Com()")
End Sub

Private Sub Form_Resize()
    Call mo_SPA_Preview.MoveC(0, 0, Width, Height)
End Sub

Private Sub mo_SPA_Preview_OnExit()
    Call Unload(Me)
End Sub

' Standard error handler
Private Sub ErrorHandler(ByVal as_Fct As String)
    Call Err.Raise(Err.Number, as_Fct & SEP1 & Err.Source, Err.Description)
End Sub
