'This example introduces the concept of a scripted form. When we use the Input Functions to prompt for input, we are limited to one prompt at a time. We can take this further and use a scripted form to prompt for multiple pieces of information. The following script shows the use of a form and some of the different types of information we can prompt for, that displays the details.
'You can cut and paste this code into the Script Editor, then click Run to execute the code.
Dim Form as ObjectForm = CreateObject("Accredo.ScriptedForm")
'Create the form and assign it into an object variable.
Form.Caption = "Test Dialog"
Form.ShowText("This is some text that is here to test the" & _
" automatic word wrapping and sizing of static text" & _
" boxes in the new dialogs")
'Add explanatory text to the form.
Form.InputCode("CustCode", "ARCUST", "Customer code", "BalanceTotal <> 0.00", False)
'The first control defined is a Lookup on the Customer code with a filter expression.
Form.InputBox("Text", "Talk to me")Form.InputBoolean("checkbox", "Like this?")Form.InputDate("Date", "What date?")Form.SetValue("Date", SystemDate)Form.InputNumber("Number", "How many?")Form.InputInteger("Integer", "How few")Form.InputList("List", "Which one", "Item1","Item2","ItemN")Form.InputMemo("Memo","Enter memo")Form.SetValue("Memo","Blah, blah, blah.")
'Add input controls that gather more information from the User, then start a loop that will either terminate once the User has entered some valid data, or clicks Cancel to stop the process. In this case the validity of the data is defined by the User selecting a Customer.
Do
If Form.Execute Then
CustCode = Form.GetValue("CustCode")
If CustCode <> "" Then
Print CustCode
Print Form.GetValue("checkbox")
Print Form.GetValue("Date")
Print Form.GetValue("List")
Print Form.GetValue("Memo")
Exit Do
Else
MsgBox("Select a Customer code")
End If
Else
Abort("Cancelled by User")
End IfLoop