How to separate character so it fill the box equally.

C

Coderz

I have a surname, firstname and middlename field. Each of this field
has to be separated in one of my report to put each character into a
box.

To understand clearly what I mean when report is printed please open
the image at the following address:

http://www.sourcecodester.com/images/data sheet.jpg

I cannot start this project until I fix this problem. I'm planning to
use either MS Access or crystal reports. The important is it will work
either of this two reporting tool.

Thank you
 
C

Coderz

Oh! I'm sorry I did not get what you mean on your first reply.

Thank you very much it works. I made some few modification. Here's the
code:

Private Sub Report_Page()
Dim MAX_CHARS As Long ' your number of boxes
Dim Count As Long
Dim Length As String

MAX_CHARS = Len(Me![LastName])

For Count = 1 To Len(Me![LastName])
If Count <= MAX_CHARS Then
Me("LastName" & Str(Count)).Value = Mid(Me![LastName], Count,
1)
End If
Next
End Sub


Thanks again



hi,
May be the missing "to" is a problem. You need for every character of
the corresponding field a TextBox. So instead of one TextBox for
surname, you need - as seen in your image - multiple text boxes for it.
Const MAX_CHARS As Long = 10 ' your number of boxes
Dim Count As Long
Dim Length As String

For Count = 1 To Len(Me![Surname])
If Count <= MAX_COUNT Then
Me("txtSurname" & Str(Count)).Value = Mid(Me![Surname], Count, 1)
End If
Next
The code above is a outline (draft/sketch) of a solution to your
problem. You use it in the appropriate report event top assign the
single characters to your text boxes.
No, this is not what I mean.
Take a close look at the idea behind...


mfG
--> stefan <--
 
S

Stefan Hoffmann

Coderz said:
Thank you very much it works. I made some few modification. Here's the
code: Good.

Private Sub Report_Page()
Dim MAX_CHARS As Long ' your number of boxes
The constant MAX_CHARS should store the number of text boxes, because
you can have names with more characters than text boxes.


mfG
--> stefan <--
 
B

Ben Watts

As long as each box is the same width you can place the field over then
ended section and right click and format the field. GO to the font tab and
in the middle of the box is the spacing section. You can experiment and set
the character spacing so that each letter of the field fits in its own box.
There is one other way if this does not work for you but it will take some
formula writing. Let me know.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top