Welcome / Home
Understanding My PC
Software Downloads
VB.NET
JAVA
C#.NET
RPG
SQL
Software Engineering
Networking
Communications
Security
Internet Links
Contact Us

How to Code Functions


How to Code Functions

 

 
Function are simply routines that when called return a value.  We provided several examples of functions.  Private function can be used anywhere, while public functions are coded in VB modules.  We use HEADLINE Scripting with lowercase prefixes for most objects.  We also use acronyms for field names  (AccountNumber=ACTNBR).   Please pardon the formatting from the HTML editor.  Indentations were lost, and it selected some funky fonts and colors.
 
Copyrighted by CompuCranks.com (2006)
 
'****************************************************************************************
Public Function FileDate(ByVal wrkUSRDTE As String) As Long
'****************************************************************************************
Dim wrkFLEDTE As Long
If wrkUSRDTE > "" Then
  Try
    wrkFLEDTE = CLng(Format(DateValue(wrkUSRDTE), "yyyyMMdd"))
  Catch
    FileDate = 0
  End Try
  FileDate = wrkFLEDTE
Else
  FileDate = 0
End If
End Function
 
'****************************************************************************************
Public Function UserDate(ByVal wrkFLEDTE As Long) As String
'****************************************************************************************
Dim wrkUSRDTE As String
If wrkFLEDTE <> 0 Then
  wrkUSRDTE = LTrim(Str$(wrkFLEDTE))
  UserDate = Mid(wrkUSRDTE, 5, 2) & "/" & Mid(wrkUSRDTE, 7, 2) & "/" & Mid(wrkUSRDTE, 3, 2)
Else
  UserDate = ""
End If
End Function