Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

the problem is: i want to combin

Status
Not open for further replies.

virginie

Programmer
Jul 24, 2002
53
IL
the problem is:

i want to combinate year+index as 4 digits

and when i do it i lost the the 4 digits:
ydate = DatePart("yyyy", date)

orderfullID = ydate & "-" & id_order


-----> 2002-1 and not 2002-0001

how can i do that ?
i tried:
orderfullID = ydatee & "-" & STR(id_order)
but it doesnt accept the STR() function

how can i cast the long integer to string with format "0000"???
 
You might try concatenating by using the Format Function.

orderfullID = ydatee & "-" & Format(id_order, "000#") Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Hi,

You can control the length of the ID_order.

Select Case Len(id_order)
Case 1
id_order= "000" & id_order
Case 2
id_order= "00" & id_order
Case 3
id_order= "0" & id_order
Case 4
id_order= id_order
End Select
ydate = DatePart("yyyy", date)

orderfullID = ydate & "-" & id_order

Good luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top