Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filling text boxes with asterisks

Status
Not open for further replies.

Hargreavesk

Technical User
Jul 18, 2001
97
GB
Hi,

I have a number of text boxes on a form. When I put in my data and print them out, I would like the rest of the text box to be filled with asterisks on my print out. I have tried to add this within my query as "*******" however, the text is wrapping and I don't know how to stop it. Can anyone help urgently?

Regards

Kate
 
Have you tried to set the textbox with an input mask and choose password? David Lerwill
"If at first you don't succeed go to the pub"
 

First get the length of the string in the box on the form
2nd find the number of characters the box can take
in your query create 2 fields

one will do a calculation of how many asterisks as below

starsneeded: numofCharactersInbox -len([txtString])

the second will do the concatenation calling a little function

displayTxt:txtString & addStars(starsneeded)




function addStars(num as integer)as string
dim x as integer
for x = 1 to num
addstars = addstars & "*"
next x
end function

is this the type of thing you meant

jo
 
David,

Thanks but I don't want the text box to be a password. Jo, I will give your suggestion a try and let you know. Thanks.

Kate
 
Jo,

I keep getting an error of undefined function in my query. Is there something I'm doing wrong?

I have put the starsneeded and displaytxt into my query and copied the function into a module.

Regards

Kate
 
can you check these out and I'll go and recheck - see if I missed anything


did you put the function in the form module if you did this would make it private to the form

and if you put it in a module you haven't put private in front of it have you

displayTxt:txtString & addStars([starsneeded])
 
just gone thru the process again in a query and it works fine

so here goes again
1: create a new query and bring down the field you want to
populate with **

2: in the next column copy the line below replacing
txtTopic with your field name

a: Len([txttopic])

3: say the text box on your form can take 20 characters
without wrapping
copy the following line into the next column


numofstars: 20-[a]

4: copy the following line into the next column

displaytxt: [txttopic] & addstars([numofstars])

this should do the job

regards

jo



 
Jo,

This has worked ok. The only thing that is puzzling me is that it asks me for a value for "a" and a value for "numofstars" is this supposed to happen?

Regards

Kate
 
morning Kate


remember when I said
: in the next column copy the line below replacing
txtTopic with your field name

a: Len([txttopic])

well a has taken on the guise of a field so you refer to it within the [ ] brackets as you would any other field so unless you are putting


numofstars: 20-[a] in the criteria line instead of the topline of the column I am a little puzzled as to why your query is requesting parameters

I'll await your reply

I'm around home all today so I'm more than happy to help.

regards

JO
 
Jo,

I can't believe I was soooo stupid, I hadn't changed the [a] and couldn't see the wood for the trees.

This is fine now. However, it does still ask me for numofstars. I think I have everything right.

Many thanks for pointing this out.

Kate
:eek:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top