Re: Displaying controls as separated values in boxes on a report

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On Thu, 23 Aug 2007 15:30:04 -0700, Virginia wrote:

I have a text field in a table and want to display it on a report within boxes.

For example, the field might say TRLU123456

I need to get the T in a box or put a border round it, then the R etc etc etc.

The field length can change so if I just draw boxes over the control the
data may move around underneath it?

Any ideas please

Easy enough.

Let's assume the largest amount of text will be 16 characters.
Adjust as necessary.

Add 16 unbound text controls to your report.

An easy way to add 16 controls is to add 1. Select it Copy and paste.
Select these 2, Copy and Paste, Select these 4, Copy and paste, etc.

Delete all of their labels. Size the controls to whatever height and
width will work. Name them "Text1", "Text2", etc... "Text16".
Position them in order, left to right.
Space them using Format + Horizontal Spacing Make Equal. Align them.

Set their Border Style to Solid, Border Width to 1 pt size.

Code the Report Section's Format event.
If they're in the Detail section, then:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim intX As Integer
Dim intY As Integer
intX = 1

For intX = 1 To Len([FieldName])
Me("Text" & intX) = Mid([FieldName], intX, 1)
Me("Text" & intX).Visible = True
Next intX

' To hide extra boxes or to show empty boxes
For intY = intX To 16
Me("Text" & intY).Visible = False ' To hide extra boxes
' Me("Text" & intY) = "" ' To show the box but delete the text
Next intY

End Sub

Set the control's FontSize to one that will match the size of the
box. Set the Alignment to Center.



--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
.



Relevant Pages

  • Re: Manipulating dates
    ... Add 8 unbound text controls to your report. ... Space them using Format + Horizontal Spacing Make Equal. ... Dim intX As Integer ... Dim intY As Integer ...
    (comp.databases.ms-access)
  • Re: Manipulating dates
    ... Add 8 unbound text controls to your report. ... Space them using Format + Horizontal Spacing Make Equal. ... Dim intX As Integer ... Dim intY As Integer ...
    (comp.databases.ms-access)
  • Re: Dynamic Creation of Option Group
    ... Grwffyn wrote: ... For intY = intX To intTotal ... colRadio.Add (ctlArray(intX, intY)) ... controls with names like ctl03_07. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Displaying controls as separated values in boxes on a report
    ... I need to get the T in a box or put a border round it, then the R etc etc etc. ... Add 16 unbound text controls to your report. ... Dim intX As Integer ... Dim intY As Integer ...
    (microsoft.public.access.reports)
  • RE: Make text boxes the same height
    ... You can set the properties of several controls at the same time by selecting ... view the properties and set the Tag to "Border" and border to transparent. ... Open your report in design view I believe he means on each field go into the ... Then scroll down to the Tag Property and type in Border. ...
    (microsoft.public.access.reports)