This:
 Code:
; Validate numeric string, strip leading zeros
Function IsNum($_)
  While Left($_, 1) = 0
    $_ = SubStr($_, 2)
  Loop
  $IsNum = IIF($_ = val($_), 1, 0)
  Exit 0
EndFunction

; validate string is numeric and 5 digits
Function IsNum3($_Id)

  If Len($_Id) = 5 And IsNum($_Id)
    '5 digits!'
  Else
    'invalid ID!'
  EndIf
  Exit 0
EndFunction

; Test various combinations
'  12345 ' IsNum3('12345') ?
'12345a6 ' IsNum3('12345a6') ?
'  abcde ' IsNum3('abcde') ?
'  a2345 ' IsNum3('a2345') ?
'  1a345 ' IsNum3('1a345') ?
'  1234a ' IsNum3('1234a') ?
'  a2a4b ' IsNum3('a2a45') ?
'  02468 ' IsNum3('02468') ?
works with leading zeros.. IsNum3 simply checks IsNum() and verifies that the length is 5. These could be combined pretty easily by adding an additional $_Length parameter to IsNum().

Glenn
_________________________
Actually I am a Rocket Scientist! \:D