Datasheet

RAIS 3.0 Programmer’s Guide – Part I : Advanced Customization
28
If d <> "" Then d = "-" & d
Forms("Input").Controls("ChildForm").Controls("Details").Controls("Regulatory
Authority Number") = " "
n = Forms("Input").Controls("ChildForm").Controls("Details").Controls ("PK Facility ID")
n = "-" & n
BuildFacilityRAN = "FAC" & r & d & n
End Function
Let us check this function by creating a new facility. As we can see, the computed value is
automatically inserted into the field [Regulatory Authority Number] if we go for creating a
new facility. This value may be considered to be only a suggested value, i.e. we may replace
it.
After we have defined, tested and validated our RAN, we must copy it to the RAIS 3.0
Creator in order to be included on next creation run. This is done most easily by simply
copying the module [RAIS Regulatory Authority Number Functions] into the creator.
2.7.1.2 Helper functions
The expression
Forms("Input").Controls("ChildForm").Controls("Details").Controls("PK Facility ID")
has been used in the previous chapter to retrieve the primary key of a new record. We may
retrieve the contents of any field of the input form in a similar manner, even regardless what
input form currently is loaded (i.e. facilities, generators, workers etc.) Always writing down
this whole expression is annoying and error prone, so let us define a helper function to make
developers life more comfortable.
RAIS Input Values
Public Function RAIS_IV(a)
RAIS_IV = Forms("Input").Controls("ChildForm").Controls("Details").Controls(a).Value
End Function
You may easily test these functions. Open the RAIS interface and select any facility. Switch
to edit mode and keep it there. Now open a new blank module and enter the following code
Public Sub test()
MsgBox RAIS_IV("regulatory authority number")
End Sub
Place the cursor at the line containing the statement “Public Sub test” and press F5. You will
see a message box popping up and displaying the authority number of that facility. Now
switch to the input form of the facility and modify the authority number. Be sure to press
enter. Switch back to the module and run again the test function: the modified authority
number is displayed.