Macro Mondays: Letting the user know of order notations

Macro Mondays: Letting the user know of order notationsThis is a perfect example on how a simple macro can improve your VISUAL experience.  I came across this requirement in the VISUAL user group forum.

As most VISUAL users know, there is no flag or indicator to let you know that there are notations attached to an order you happen to be in.  You would have to manually hit the Notation icon or menu item to see whether there’s important notes relating to the order.  This obviously leaves room for human error – forgetting to check if the order has notes.

Customer Order Entry Notaations

The following OnLoad macro does a quick database lookup to check if the order has notes.  If notes do exist, the macro will then open the Order Notation window using SendKeys method.  This way, you can be sure that the user see any important notes.  This assumes that their eyes are open and directed towards the monitor!

‘Insert this macro in Customer Order Entry module
‘Save the macro as OnLoad

Dim wshShell

Dim x
Dim strCnn
Dim SQL
Dim rs

Dim OrderHasNotations

Dim strServerName
Dim strDatabase
Dim strUserName
Dim strPassword

strServerName=”E N T E R    N A M E    O F    D A T A B A S E    S E R V E R”
strDatabase=”E N T E R    N A M E    O F    D A T A B A S E”
strUserName=”E N T E R    U S E R N A M E”
strPassword=”E N T E R    P A S S W O R D”

strcnn=”Driver={SQL Server};Server=” & strServerName & “;Database=” & strDatabase & “;Uid=” & strUsername & “;Pwd=” & strPassword & “;”

set rs = CreateObject(“ADODB.Recordset”)

OrderHasNotation=0

SQL=”SELECT COUNT(*) FROM NOTATION WHERE OWNER_ID='” & ORDER_ID & “‘”
rs.open SQL, strcnn

if not rs.eof then
    rs.movefirst
    if rs(0)>0 then
        OrderHasNotations=1
    end if
end if

rs.close
set rs=nothing

if OrderHasNotations=1 then
    Set wshShell = CreateObject(“WScript.Shell”)
wshShell.AppActivate(“Customer Order Entry”)

    wshShell.Sendkeys “+{F7}”
end if

‘End of Macro


Macro Mondays is a series highlighting macros that I use to validate, automate and enforce business processes within the VISUAL application.  If you have any macros that you wish to share, please feel free to send them to me at rich@visualnuggets.com.  I’ll be sure to post them on your behalf. 

The Visual Manufacturing International User Group (VMIUG) is a great resource for VISUAL-related topics 


Copyright 2019 visualnuggets © All Rights Reserved