Jumat, 02 Maret 2012

Bls: [MS_AccessPros] Re: Give space between chracters in a field

 

thanx Clive...
How should i use this code ? i have a textbox named txtSpace in a report (rptIDCard) and i want to display
the results of the code that you have given to the txtSpace...sorry... i'm newbie in VBA.
I have maked a new module and paste the code, and then on open event of rptIDCard i have typed theese :

Call TxtNumSpaced
Me.txtSpace=TxtNumSpaced

it gived erorr when i tried to open the report,,,

Regards
Hendra

________________________________
Dari: Clive <zctek@aol.com>
Kepada: MS_Access_Professionals@yahoogroups.com
Dikirim: Jumat, 2 Maret 2012 16:51
Judul: [MS_AccessPros] Re: Give space between chracters in a field


 
Hi Hendra,

You could do it with a Function like;

Public Function TxtNumSpaced(n As String) As String
' Add a space between each characater of String.
Dim i As Integer
Dim s As String
On Error GoTo MyErr
For i = 1 To Len(n)
s = s & Mid$(n, i, 1) & " "
Next i
TxtNumSpaced = Trim(s)
MyExit:
Exit Function
MyErr:
MsgBox "Err =" & Err & vbCrLf & Err.Description
Resume MyExit
End Function

Regards, Clive.

--- In MS_Access_Professionals@yahoogroups.com, "agesthahendra@..." <agesthahendra@...> wrote:
>
> Hi Everyone..
>
> How can we give space between characters in the value of a field..?
> For example i have a field (Text type) with value = 12345, i want to
> give space between the characters to be 1 2 3 4 5 and display it on
> a report or form...
> Any directions would be appreciated...thank you
>
> Regards
> Hendra
>

[Non-text portions of this message have been removed]

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar