customizing a Sage screen in a VBA macro

SOLVED

I added an additional control screen (AccpacIC3530UICtrl1) to a user form and i want to customize it to perform specific functions

Such as set the default quantity to (1).

And also set the location to the quantity on hand above (1)

Thank You

  • 0

    Set references to the underlying data sources using statements like:

    Public WithEvents dsOrder As AccpacOE1100.ACCPACDSControl

    then your code goes into the dsOrder.OnRecordChanging event.

  • Set references to the underlying data sources using statements like:

    Public WithEvents dsOrder As AccpacOE1100.ACCPACDSControl

    then your code goes into the dsOrder.OnRecordChanging event.

    Can You help with an example? .. I'm new to this ecosystem

  • +1 in reply to Nana Sarpong Kwatchey
    verified answer

    Option Explicit

    Dim iMinHeight As Single
    Dim iMinWidth As Single

    Const Post_Button = "APP_Save_Button"
    Public WithEvents dsOrder As AccpacOE1100.ACCPACDSControl
    Public WithEvents dsOrderOpt As AccpacOE1100.ACCPACDSControl
    Public WithEvents dsOrderLine As AccpacOE1100.ACCPACDSControl
    Public WithEvents dsOrderLineOpt As AccpacOE1100.ACCPACDSControl
    Public WithEvents lstdetails As AccpacFldList.AccpacViewList
    Public WithEvents dsPrepay As AccpacOE1100.ACCPACDSControl
    Public WithEvents dsPrepay1 As AccpacDataSrc.AccpacDataSource
    Public WithEvents dsPrepay2 As AccpacDataSrc.AccpacDataSource
    Public WithEvents dsPrepay3 As AccpacDataSrc.AccpacDataSource
    Public WithEvents fldProcess As VB.VBControlExtender
    Public WithEvents fldType As VB.VBControlExtender
    Dim ArPayTypes As AccpacView

    Public bHasCategory As Boolean
    Dim nMainhWnd As Long
    Private Sub AccpacOE1100UICtrl1_BeforeUIAppClosed()
    Dim iResponse As Integer

    SaveSetting "OEOrders", "Saved Settings", "MinMax", Me.WindowState

    If Me.WindowState = 0 Then
    SaveSetting "OEOrders", "Saved settings", "LastHeight", Me.Height
    SaveSetting "OEOrders", "Saved settings", "Lasttop", Me.Top
    SaveSetting "OEOrders", "Saved settings", "Lastleft", Me.Left
    End If

    End Sub

    Private Sub AccpacOE1100UICtrl1_OnPopupClosed(ByVal strPopupName As String)
    If strPopupName = "frmPrePayment" Then
    Set dsPrepay1 = Nothing
    Set dsPrepay2 = Nothing
    End If

    End Sub

    Private Sub AccpacOE1100UICtrl1_OnUIAppOpened()
    Dim hWnd As Long
    Dim hIcon As Long
    Dim MultiInstResult As Integer
    Dim iWindow As Integer


    With Me.AccpacOE1100UICtrl1
    Me.cmdPost.Enabled = .UIAppControls(Post_Button).Enabled
    .UIAppControls("cmdShipAll1").MacroVisibleFlag = False
    .UIAppControls(Post_Button).MacroVisibleFlag = False
    .UIAppControls("afeOEORDHterritory3").MacroVisibleFlag = False

    Set Me.Icon = .UIIcon
    hIcon = SendMessage(Me.hWnd, WM_GETICON, ICON_BIG, ByVal 0)
    SendMessage nMainhWnd, WM_SETICON, ICON_BIG, ByVal hIcon
    sCompanyID = .UIDBLinks(1).Session.CompanyID

    Me.Caption = .UISession.CompanyID & " - " & .UIName
    iMinHeight = 11765
    iMinWidth = 14940
    Me.Width = iMinWidth
    Me.Height = iMinHeight
    Form_Resize

    Set a4wLinkRead = .UISession.OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READONLY)
    Set a4wLink = .UISession.OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)

    Set dsOrder = .UIDSControls("adsOEORDH")
    Set dsOrderOpt = .UIDSControls("dsOEORDHO")
    Set dsOrderLine = .UIDSControls("adsOEORDD")
    Set dsOrderLineOpt = .UIDSControls("dsOEORDDO")
    Set dsPrepay = .UIDSControls("adsOEORPP")
    Set lstdetails = .UIAppControls(Vl_Oe_Details).GetControl
    Dim i As Integer

    For i = 1 To lstdetails.ColumnCount
    If lstdetails.GetColumnName(i) = "Customer Item No." Then
    lstdetails.SetColumnName i, "Catalog Number"
    End If
    Next

    End With

    With a4wLinkRead
    .OpenView "AR0012", ArPayTypes
    .OpenView "OE0420", OeInvRead
    .OpenView "IC0310", IcItemRead
    .OpenView "IC0313", IcItemORead
    .OpenView "IC0370", IcLocRead
    .OpenView "IC0274", IcCuprRead
    .OpenView "IC0480", IcPriceRead
    End With

    iWindow = GetSetting("OEOrders", "Saved settings", "minmax", 0)
    Me.WindowState = iWindow

    AppTasklist Me

    Me.AccpacOE1100UICtrl1.UIAppControls("fecoeordh_lastinvnumber").Width = Me.AccpacOE1100UICtrl1.UIAppControls("fecoeordh_lastinvnumber").Width - 1200
    Me.AccpacOE1100UICtrl1.UIAppControls("fecoeordh_lastshipnumber").Width = Me.AccpacOE1100UICtrl1.UIAppControls("fecoeordh_lastshipnumber").Width - 1200
    Me.lblLastInvDate.Top = Me.AccpacOE1100UICtrl1.UIAppControls("fecoeordh_lastinvnumber").Top + 50
    Me.AccpacOE1100UICtrl1.UIAppControls("afeOEORDHordnumber").SetFocus
    Me.lblLastInvDate.ZOrder 0

    Me.cmdCopyBill.Visible = True
    Me.cmdPrintLabel.Visible = True
    Me.cmdPost.Visible = True

    End Sub