number format with space

meenctg

Learn24bd
Local time
Tomorrow, 04:54
Joined
May 8, 2012
Messages
133
in my table i have a field ID here are values like as 123456 234345 233434 I wanna make report with this table, here ID field will be shown up with space every number example : file value : 12345 I wanna in report : 1 2 3 4 5 6 I think i have cleared what i wanna. Please anybody help me how to will i do this?
 
Here is a simple function you can use:
Code:
Function AddSpace(GetNumb As String) As String
Dim X As Integer
AddSpace = Left(Nz(GetNumb, ""), 1)
If Len(GetNumb) > 1 Then
For X = 2 To Len(GetNumb)
AddSpace = AddSpace & " " & Mid(GetNumb, X, 1)
Next X
End If
End Function
 
If Then Next is not necessary here
 
Here is a simple function you can use:
Code:
Function AddSpace(GetNumb As String) As String
Dim X As Integer
AddSpace = Left(Nz(GetNumb, ""), 1)
If Len(GetNumb) > 1 Then
For X = 2 To Len(GetNumb)
AddSpace = AddSpace & " " & Mid(GetNumb, X, 1)
Next X
End If
End Function

Thanks for your quick response. I am not expert that is why, i can't understand where i'll apply this code. Plz give instructions
 
Here is billmeye's function exactly how you can use it
Code:
Public Function AddSpace(GetNumb As String) As String
Dim X As Integer
   AddSpace = Left(Nz(GetNumb, ""), 1)
   For X = 2 To Len(GetNumb)
     AddSpace = AddSpace & " " & Mid(GetNumb, X, 1)
   Next X
End Function
Put this function in a regular module (not the form module)

Create a new text box
and this
Code:
=AddSpace([YourFieldNameHere])
to this box Control Source

Run the report.
If (or when) all is OK, hide the first textbox (that text box without spaces).
DO NOT remove it.
 

Users who are viewing this thread

Back
Top Bottom