Jumat, 02 Maret 2012

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

 

Hendra-

Me.txtSpace = TxtNumSpaced(Me.nameofyourfield)

Or in a text box, set the Control Source to:

=TxtNumSpaced([name of field from record source])

John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Nashua, NH)

-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Agestha Hendra
Sent: Friday, March 02, 2012 12:18 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: 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]

------------------------------------

Yahoo! Groups Links

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar