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.ConnInf

penADOConn
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,