Keeping a number six digits

I have a string submitted from the user. The string represents a number that is 6 chars long and will contain leading zeros and always greater than 1000. Ex: 006666. This string is converted to long in my database. Conversion process removes leading 0's. How can I convert it to the original format to execute queries on the ODBC connection? I'm currently using the following formula and thought there may be a mathematical solution possibly by division or a VB function.
sPID = "006666"
Select case clng(sPID)
   case 1000 to 9999
        sPRODID = "00" & SPID
   case 10000 to 99999
        sPRODID = "0" & SPID
end select
drodelaAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
mlmccConnect With a Mentor Commented:
Try

sPRODID = Format(cstr(sPID),"000000")

mlmcc
0
 
fymCommented:
something like mimicc:

sPORDID = left("000000" & pid,6)
0
 
drodelaAuthor Commented:
This is what I needed. Thanks.
0
 
mlmccCommented:
Glad to help

mlmcc
0
All Courses

From novice to tech pro — start learning today.