A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Remove leading 0's from Text field



 
 
Thread Tools Display Modes
  #1  
Old May 12th, 2004, 06:45 PM
Bruce
external usenet poster
 
Posts: n/a
Default Remove leading 0's from Text field

I have a text field with leading zeros. Is there a way to
strip these off in Access 2000.

thks

Bruce
  #2  
Old May 12th, 2004, 08:22 PM
RobFMS
external usenet poster
 
Posts: n/a
Default Remove leading 0's from Text field

Is the values in the field alphanumeric or just numeric?

--
Rob

FMS Professional Solutions Group
http://www.fmsinc.com/consulting

Software Tools for .NET, SQL Server, Visual Basic & Access
http://www.fmsinc.com

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
"Bruce" wrote in message
...
I have a text field with leading zeros. Is there a way to
strip these off in Access 2000.

thks

Bruce



  #3  
Old May 12th, 2004, 08:35 PM
Bruce
external usenet poster
 
Posts: n/a
Default Remove leading 0's from Text field

Field is Alph
-----Original Message-----
Is the values in the field alphanumeric or just numeric?

--
Rob

FMS Professional Solutions Group
http://www.fmsinc.com/consulting

Software Tools for .NET, SQL Server, Visual Basic & Access
http://www.fmsinc.com

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
"Bruce" wrote in

message
...
I have a text field with leading zeros. Is there a way

to
strip these off in Access 2000.

thks

Bruce



.

  #4  
Old May 13th, 2004, 12:03 AM
John Vinson
external usenet poster
 
Posts: n/a
Default Remove leading 0's from Text field

On Wed, 12 May 2004 10:45:20 -0700, "Bruce"
wrote:

I have a text field with leading zeros. Is there a way to
strip these off in Access 2000.

thks

Bruce


One sneaky way: run an Update query updating the field to
CStr(CLng([fieldname]).

If the "numbers" have no decimal places and fewer than nine digits it
should work fine.

More tedious but more general: write a VBA function such as

Public Function StripZero(strIn As String) As String
Dim iPos As Integer
StripZero = ""
For iPos = 1 to Len(strIn)
If Mid(strIn, iPos, 1) 0 Then
StripZero = Mid(strIn, iPos)
Exit Function
End If
Next iPos
End Function

and update the field to StripZero([fieldname]).

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:02 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.