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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Numeric to Text 1

Status
Not open for further replies.

cariengon

Technical User
Mar 18, 2002
283
US
I have a number field that needs to be a text field in order to combine them to narrow down the unique values.

THe first set of numbers should always be three digits, and if they are a one or two-digit number, zeros should be displayed. (005, 010, 050, 100, 110, etc).

I have set ALL of my formats in the tables, forms, queries and reports, where this first 3-digit number appears to be 000. But when I do the concantanation to combine the numbers, the leading zeros are lost.

Here's the code:

Private Sub LE_1_LostFocus()
Me.LE_Acct_1 = Me.LE_1 & "-" & "135" & Me.LE_2
Me.LE_Acct_2 = Me.LE_2 & "-" & "135" & Me.LE_1
End Sub

Me.LE_1 = 045
Me.LE_2 = 130

What I should get: What I'm getting:
Me.LE_Acct_1 = 045-135130 45-135130
Me.LE_Acct_2 = 130-135045 130-13545


I've tried doing formatting within the code and it still doesn't work. Any suggestions?

Thanks,
Carie
 
Try using......

CStr(Format(Me.LE_1, "000"))

and

CStr(Format(Me.LE_2, "000"))

anywhere they appear in the code. Please remember to give helpful posts the stars they deserve!
This makes the post more visible to others in need! [thumbsup2]

Robert L. Johnson III, A+, Network+, MCP
Access Developer/Programmer
robert.l.johnson.iii@citigroup.com
 
Thankyou, Thankyou, Thankyou!!!

I've been so immersed in my application, I forget the little things... ;)

It worked perfectly!

Carie
[2thumbsup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top