How are you getting the $DHCPaddress value? You do not show us. I suspect that you substr in wrong. I would recommend using val(split($DHCPaddress,".")[3]) for the last octet.
_________________________
Home page: http://www.kixhelp.com/hb/