space in an input mask

G

Guest

hi,

is there an input mask i could use on a report to do the following:

(1) if i enter "THISISATEST" on my form, i want
the text box on my report to display: "T H I S I S A T E S T".

(2) if i enter "THIS IS A TEST" on my form, i want
the text box on my report to display: "T H I S I S A T E ST".

i tried putting in the input mask, "A A A A A A A A A A A A A", but
it only works when there no spaces in between letters or words [i.e.
refer to example (1)]. when i do example (2), i don't the result i want. it
ignores the spaces i put in the form and displays it as it is "THIS IS A
TEST".

i'm trying to properly line-up the characters on an pre-existing paper form.
example the paper has the following format:

Name: | | | | | | | | | |
|

i want to properly space the characters so that it will line up properly on
the form.

any ideas would be appreciated. feel free to send me email directly.
thanks in advance.

Paul
 
V

Van T. Dinh

I would suggest InputMask is not the way to do it.

Rather I would simply store the actual data entered and pad it out when the
value is being used on the Report. For example, you can create a small
function with code to pad out like:

****Untested****
Public Function PaddedOut(strInput As String) As String

Dim lngOriLength As Long
Dim lngIndex As Long
Dim strTemp As String

lngOriLength = Len(strInput)
strTemp = ""

For lngIndex = 1 to lngOrigLength - 1
strTemp = strTemp & Mid(strInput, lngIndex, 1) & " "
Next lngIndex

PaddedOut = strTemp & Mid(strInput, lngOriLength, 1)

End Function
********
 
R

Roger Carlson

I would use a small function. Put the following in a module:

Function AddSpaces(MyString As String) As String
Dim NewString As String
Do While Len(MyString) > 0
NewString = NewString & Left(MyString, 1) & " "
MyString = Mid(MyString, 2)
Loop
AddSpaces = Trim(NewString)
End Function

You can use this in your report by setting the control source to:
=AddSpaces([YourFieldName])

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
M

Mike Painter

Paul said:
hi,

is there an input mask i could use on a report to do the following:

(1) if i enter "THISISATEST" on my form, i want
the text box on my report to display: "T H I S I S A T E S T".

i want to properly space the characters so that it will line up
properly on the form.

any ideas would be appreciated. feel free to send me email directly.
thanks in advance.

There is no need for code.

Format the output with @ @ @ @ @ @ @ @ @ and right, left or center justify.

Note there are spaces between the "@" marks. I'm not sure what you mean by
line up properly but since most of what appears on the screen is
proportional you will have to pick your font carefully to neatly line things
up.
 

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

Similar Threads

Remove input mask format 4
Input Mask 1
Extending Input Mask 4
Input Mask 3
Input Mask 2
Inserting default value in part of input mask 3
Input Mask for SS# 5
Input Mask Help 1

Top