Purchase History Button Purchase Order Entry

SOLVED

Hi Guys

I am trying to get a window to display on purchase order entry which will shows everything we purchased from the vendor in the past.

On sales order you have the binoculars to do this but all you have on Purchase Order is Alias Item Lookup.

Not all items we have ever purchased from each customer shows up on the alias item list.

Anyway to do this ?

Thanks Guys

Parents
  • +1
    verified answer

    I'm a feeling generous today. Create a button on the line detail panel and add this script to the button.  It will display in a message box purchase history for all orders still in the open files. You should be able to edit to read the history files if you want.

    Dim Input
    Input = PO_PurchaseOrderDetail_Bus_ItemCode
    strConnectionString = "DSN=SOTAMAS90;UID=User ID Here|Three digit company code here;PWD=password here"
    Set connection = CreateObject("ADODB.Connection")
    connection.Open strConnectionString

    Set RS = CreateObject("ADODB.Recordset")
    strSQL="SELECT * FROM  PO_PurchaseOrderDetail WHERE PO_PurchaseOrderDetail.ItemCode ='"& Input &"'"
    RS.Open strSQL, connection

    msg =""
    do while not RS.EOF
    msg=msg+"Item: " & rs("ItemCode")& "  Purchase Order: " & rs("PurchaseOrderNo") & "  Qty Ordered: " & rs("QuantityOrdered") & "  Qty Received:" & rs("QuantityReceived") & "  Unit Cost:" & rs("UnitCost") & vbCRLF
    RS.movenext
    loop
    msgbox msg

    RS.Close
    connection.close

    Set RS = nothing
    set connection = nothing

  • 0 in reply to BigLouie

    Thanks Louie, I seem to be running into an issue and maybe I am not doing something correct. See the script below. I replaced the login credentials as requested on the script. See images below.

Reply Children