several simple questions about text boxes

  • Thread starter Thread starter Kevin S.
  • Start date Start date
K

Kevin S.

I'm not the brightest MS Access user, so I need a little help.

Question #1

Lets say I have 5 text boxes that hold 5 characters each, like if you were
entering a serial key into a setup program. Once 5 characters are entered,
how can I make the cursor go to the next text box?

Question #2

Code to determine length of a text string in a text box?

Question #3

Let's say I want to pull out the third character of any word, such as my
name..Kevin...... is there something better than
using.........right(left(text0,3),1)......or is that good enough?

Question #4

This one is less important, so if there isn't an easy answer, don't bother
with it. I know storing passwords in a table in MS Access is unsecure. Just
import the table and remove the mask. However, is their an easy way to
convert the whole password to something less obvious? Like encrypting it or
something? And how can I change it back?

Thanks for the help.
-Big K
 
Kevin S. said:
I'm not the brightest MS Access user, so I need a little help.

Question #1

Lets say I have 5 text boxes that hold 5 characters each, like if you were
entering a serial key into a setup program. Once 5 characters are entered,
how can I make the cursor go to the next text box?

In the table design mode..make the field 5 chars. Then, in the forms
designs, set the text control to "auto tab". (this setting is in the
other...and will make the cursor jump when the end of text box is hit). If
your text box is un-bound..I believe auto tab will also work if you use a
input mask (and thus don't have to rely on the table field length setting).
Question #2

Code to determine length of a text string in a text box?

The answer depends on WHEN you need to get the length of the string. In the
after update event...the text has been moved into the text box value. So you
can go:

msgbox "the length of the field is" & len(me!MyContorlBoxName.value)

Note that "value" is the default..so often we use:

me!MyContorlBoxName

However, if you are using a event like keydown..then the focus, or even an
attempt to move off the control HAS NOT occurred. This means that the
"value" of the control has NOT yet had a chance to be updated. In this case,
you must use the .text property. Of course..the .text property ONLY works
when the control has the focus
Question #3

Let's say I want to pull out the third character of any word, such as my
name..Kevin...... is there something better than
using.........right(left(text0,3),1)......or is that good enough?

I use the mid function.

msgbox "The 3rd char you typed is " & mid("yourtext",3,1)
Question #4

This one is less important, so if there isn't an easy answer, don't bother
with it. I know storing passwords in a table in MS Access is unsecure. Just
import the table and remove the mask. However, is their an easy way to
convert the whole password to something less obvious? Like encrypting it or
something? And how can I change it back?

Hum, you make up your own munch and crunch routine. You could take each
character, and convert it to something else

dim strPass as string

strPass = "hello"

for i = 1 to len(strPass)
c = mid(strPass,i,1)
cval = asc(c)
next i

cval will be the actual ASCII number of the single character. You could add
your own routine that divides...or perhaps even squares the number. You then
take the square root to get your original number back (so, save each char as
a number seperated by comma..and the you can reverse it).
 
Back
Top