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!

Displaying text in a datagrid without zeros!

Status
Not open for further replies.

arneweise77

Programmer
Apr 25, 2002
46
SE
Hi!

I need to solve this problem!
Having a text, let´s say 0000478564, retrieved from access and displayed in a datagrid. I need to remove or in some way get rid of the first 4 zeros.
Is there a function for this problem? or a sqlcommand to solve this.

Thanks in advance!

Arne
 
If you have the field set as numeric, then it will automatically strip off the leading zero's. The money's gone, the brain is shot.....but the liquor we still got.
 
or you could get rid of them after you retrieve them from the DB with something like this
<HTML>
<HEAD><TITLE></TITLE>
<SCRIPT LANGUAGE=&quot;VBScript&quot;>
<!--
Sub extract()
Dim TheForm, MyVar
TheForm=form1.Text1.value
'Start by trimming leading/trailing spaces

'Now, replace spaces...
Do While InStr(1, TheForm, &quot;0&quot;)
TheForm = Replace(TheForm, &quot;0&quot;, &quot;&quot;)
Loop
MyVar = MsgBox (&quot;Here it is without zeros &quot; & TheForm)
End Sub

-->
</SCRIPT>
</HEAD>
<BODY>
<H3>Simple Validation</H3><HR>
<form Name=&quot;form1&quot;>

<input TYPE=&quot;TEXT&quot; name=&quot;Text1&quot; SIZE=&quot;30&quot;>
<input TYPE=&quot;button&quot; VALUE=&quot;reformat&quot; onClick=&quot;extract()&quot;>
</form>
</BODY>
</HTML> I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top