Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macola ES VBA Starting Out

Status
Not open for further replies.

CBCPaul

IS-IT--Management
Aug 5, 2013
2
0
0
US
I am new to Macola ES version 9.5.100 and programming so be very appreciative if someone could help by providing me a sample code to do the following:

In order entry, when someone enters "Qty Ordered", I would like it to show a message box that display "qty_on_hand" from the "iminvloc_sql" table

Thank you,
 
Why not just click the "loc/qty" button? No need to program functionality that already exists.

Software Training, Implementation, Programming and Support for Macola Progression, Macola ES, Synergy, and Crystal Reports. Check out our Macola tools:
 
Well, the main purpose of the thread was to get an idea on how to get started so I was hoping for a sample code. What I am really looking to do is to utilize user_def_fld_1 in iminvloc_sql and set a maximum qty per order to develop a "no back order promise". Every time that a customer orders greater than maximum qty per order a warning message will generate and inform the staff to call a supervisor. From there, I will eventually want to check maximum qty per week, preventing customer ordering on multiple order defeating the purpose of maximum. Anyhow, long story short, I did some reading on VB scripting and from the thread I was able to come up with the code (works but require more tuning). In case any one is interested, here is the code:

'Max Qty Per Order VB Script (Active X need to be referenced)
Private Sub QtyOrderedCredited_LoseFocus(AllowLoseFocus As Boolean)

Dim rs1 As New ADODB.Recordset
Set rs1.ActiveConnection = macForm.ConnInfo_OpenADOConn

sqlstring1 = "select user_def_fld_1 from iminvloc_sql where loc ='CBC' and item_no='" & macForm.Item.Text & "'"
rs1.Open sqlstring1
If macForm.QtyOrderedCredited.Text > rs1(0) Then
MsgBox ("PLEASE INFORM SUPERVISOR: " & macForm.QtyOrderedCredited.Text & _
" - " & Trim(rs1(0)) & " = " & (macForm.QtyOrderedCredited.Text - rs1(0)) & _
" " & macForm.UOM.Text)
End If

End Sub

If anyone has any recommendations on better coding, please feel free to input because this is like my first time writing a VB script.

Thanks,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top