Ken's team recently inherited a VB6-based application. They were a bit a disappointed -- but not surprised -- to see that the application reinforced those certain stereotypes of VB applications. After a little while of going through and documenting the code, they were delighted to finally see some a comment and even error handling .... errr .... wait .... at least it was one of the nicer named functions ...

Public Function VerifyOrdNum(xOrdNum As String) As Boolean
  VerifyOrdNum = True
  Dim numOrd As Long
  
  If Len(xOrdNum) <> 7 Then
    MsgBox "Enter a seven (7) digit Order Number", vbCritical, strErrTitle
    VerifyOrdNum = False
    Exit Function
  End If
  
  'check the numeric order number
  On Error GoTo errorhandler
  numOrd = xOrdNum
  Exit Function

errorhandler:
  MsgBox "Order # must be numeric", , strErrTitle
  VerifyOrdNum = False
      
End Function
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!