Imput Mask creating a problem in field for input on form

G

Guest

Hi

I'm using an input mask on a field. The mask is
Aaaaaaa (so the last 6 characters are optional.)
The mask is set up so that the underscore character appears for every
character in the mask, denoting the field length (this includes the optional
characters.)
The problem is this: if a user clicks on the field on a form (rather than
tabbing to it,) if they don't click on the very far left of the field, the
cursor "lands" somewhere between the start and end of the field which is very
fiddly for data input. The user will either have to use the left arrow key
to go to the start of the field... or, even worse, they might not even
realise that they're not at the start of the field and type in a short entry
(maybe 3 characters) midway in the field!

How can I prevent this? Hopefully users will tab to the field but I need to
sort this so they can't click somewhere in the middle.

Also I've just found that when you use "a" in a mask, it permits a space to
be entered! Is there any way that you can specify a mask for an optional
character (either letter or digit) so that it cannot be a space? I need to
ensure a user doesn't enter any gaps between characters in the field.

Can you help?
TIA if you can

Rich
 
A

Al Camp

Rich,
Use the OnClick event for your date field with this code (ex. ShortDate
field)
[YourField].SelLength = 8
Adjust the 8 to suit your format. That should select the whole date format
if you mouse click into the field, and tabbing will work as always.
 
G

Guest

Thanks for your quick reply Al.
I tried your code (in VBA on the OnClick event)
It doesn't stop the field being selected midway when you click it. This is
on a field which is not a date but a series of characters (numbers and
letters)
I've just found out that the original mask alone does not automatically
include spaces in the first characters if the user clicks midway in the
field. It just says "The value you entered isn't appropriate for the input
mask" and you have to enter from the start of the field.

So there are still 2 problems:
1) the user can still click midway in the field
2) the user can input spaces anywhere after the first character if they want
(and I need to prevent spaces being input)

em is spaces... the user can still input spaces in the field, even though
"a" is specified. The code you gave doesn't seem to have fixed this.

I also need to find a solution for the same problem in a short date field.

Please help if you can!
Thank you
Rich

Al Camp said:
Rich,
Use the OnClick event for your date field with this code (ex. ShortDate
field)
[YourField].SelLength = 8
Adjust the 8 to suit your format. That should select the whole date format
if you mouse click into the field, and tabbing will work as always.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Rich1234 said:
Hi

I'm using an input mask on a field. The mask is
The mask is set up so that the underscore character appears for every
character in the mask, denoting the field length (this includes the
optional
characters.)
The problem is this: if a user clicks on the field on a form (rather than
tabbing to it,) if they don't click on the very far left of the field, the
cursor "lands" somewhere between the start and end of the field which is
very
fiddly for data input. The user will either have to use the left arrow
key
to go to the start of the field... or, even worse, they might not even
realise that they're not at the start of the field and type in a short
entry
(maybe 3 characters) midway in the field!

How can I prevent this? Hopefully users will tab to the field but I need
to
sort this so they can't click somewhere in the middle.

Also I've just found that when you use "a" in a mask, it permits a space
to
be entered! Is there any way that you can specify a mask for an optional
character (either letter or digit) so that it cannot be a space? I need
to
ensure a user doesn't enter any gaps between characters in the field.

Can you help?
TIA if you can

Rich
 
A

Al Camp

What's the length of your field, and what is the InputMask.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Rich1234 said:
Thanks for your quick reply Al.
I tried your code (in VBA on the OnClick event)
It doesn't stop the field being selected midway when you click it. This
is
on a field which is not a date but a series of characters (numbers and
letters)
I've just found out that the original mask alone does not automatically
include spaces in the first characters if the user clicks midway in the
field. It just says "The value you entered isn't appropriate for the
input
mask" and you have to enter from the start of the field.

So there are still 2 problems:
1) the user can still click midway in the field
2) the user can input spaces anywhere after the first character if they
want
(and I need to prevent spaces being input)

em is spaces... the user can still input spaces in the field, even though
"a" is specified. The code you gave doesn't seem to have fixed this.

I also need to find a solution for the same problem in a short date field.

Please help if you can!
Thank you
Rich

Al Camp said:
Rich,
Use the OnClick event for your date field with this code (ex.
ShortDate
field)
[YourField].SelLength = 8
Adjust the 8 to suit your format. That should select the whole date
format
if you mouse click into the field, and tabbing will work as always.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Rich1234 said:
Hi

I'm using an input mask on a field. The mask is
Aaaaaaa (so the last 6 characters are optional.)
The mask is set up so that the underscore character appears for every
character in the mask, denoting the field length (this includes the
optional
characters.)
The problem is this: if a user clicks on the field on a form (rather
than
tabbing to it,) if they don't click on the very far left of the field,
the
cursor "lands" somewhere between the start and end of the field which
is
very
fiddly for data input. The user will either have to use the left arrow
key
to go to the start of the field... or, even worse, they might not even
realise that they're not at the start of the field and type in a short
entry
(maybe 3 characters) midway in the field!

How can I prevent this? Hopefully users will tab to the field but I
need
to
sort this so they can't click somewhere in the middle.

Also I've just found that when you use "a" in a mask, it permits a
space
to
be entered! Is there any way that you can specify a mask for an
optional
character (either letter or digit) so that it cannot be a space? I
need
to
ensure a user doesn't enter any gaps between characters in the field.

Can you help?
TIA if you can

Rich
 
A

Al Camp

Also... Copy and Paste the code you wrote on the OnClick event into your
reply.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Al Camp said:
Rich,
Use the OnClick event for your date field with this code (ex. ShortDate
field)
[YourField].SelLength = 8
Adjust the 8 to suit your format. That should select the whole date
format if you mouse click into the field, and tabbing will work as always.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Rich1234 said:
Hi

I'm using an input mask on a field. The mask is
The mask is set up so that the underscore character appears for every
character in the mask, denoting the field length (this includes the
optional
characters.)
The problem is this: if a user clicks on the field on a form (rather
than
tabbing to it,) if they don't click on the very far left of the field,
the
cursor "lands" somewhere between the start and end of the field which is
very
fiddly for data input. The user will either have to use the left arrow
key
to go to the start of the field... or, even worse, they might not even
realise that they're not at the start of the field and type in a short
entry
(maybe 3 characters) midway in the field!

How can I prevent this? Hopefully users will tab to the field but I need
to
sort this so they can't click somewhere in the middle.

Also I've just found that when you use "a" in a mask, it permits a space
to
be entered! Is there any way that you can specify a mask for an optional
character (either letter or digit) so that it cannot be a space? I need
to
ensure a user doesn't enter any gaps between characters in the field.

Can you help?
TIA if you can

Rich
 
A

Al Camp

Rich,
Aplogies... I know that your Mask is Aaaaaaa and your length is 7.
Try this code for clicking midway on the field...
Private Sub YourField_Click()
Me.YourField.SelStart = 0
Me.YourField.SelLength = 7
End Sub

That should do it... I had time to test on a field with an InputMask just
like yours.

Re: Problem2...the spaces... hang on and I'll get back ASAP...
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Rich1234 said:
Thanks for your quick reply Al.
I tried your code (in VBA on the OnClick event)
It doesn't stop the field being selected midway when you click it. This
is
on a field which is not a date but a series of characters (numbers and
letters)
I've just found out that the original mask alone does not automatically
include spaces in the first characters if the user clicks midway in the
field. It just says "The value you entered isn't appropriate for the
input
mask" and you have to enter from the start of the field.

So there are still 2 problems:
1) the user can still click midway in the field
2) the user can input spaces anywhere after the first character if they
want
(and I need to prevent spaces being input)

em is spaces... the user can still input spaces in the field, even though
"a" is specified. The code you gave doesn't seem to have fixed this.

I also need to find a solution for the same problem in a short date field.

Please help if you can!
Thank you
Rich

Al Camp said:
Rich,
Use the OnClick event for your date field with this code (ex.
ShortDate
field)
[YourField].SelLength = 8
Adjust the 8 to suit your format. That should select the whole date
format
if you mouse click into the field, and tabbing will work as always.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Rich1234 said:
Hi

I'm using an input mask on a field. The mask is
Aaaaaaa (so the last 6 characters are optional.)
The mask is set up so that the underscore character appears for every
character in the mask, denoting the field length (this includes the
optional
characters.)
The problem is this: if a user clicks on the field on a form (rather
than
tabbing to it,) if they don't click on the very far left of the field,
the
cursor "lands" somewhere between the start and end of the field which
is
very
fiddly for data input. The user will either have to use the left arrow
key
to go to the start of the field... or, even worse, they might not even
realise that they're not at the start of the field and type in a short
entry
(maybe 3 characters) midway in the field!

How can I prevent this? Hopefully users will tab to the field but I
need
to
sort this so they can't click somewhere in the middle.

Also I've just found that when you use "a" in a mask, it permits a
space
to
be entered! Is there any way that you can specify a mask for an
optional
character (either letter or digit) so that it cannot be a space? I
need
to
ensure a user doesn't enter any gaps between characters in the field.

Can you help?
TIA if you can

Rich
 
A

Al Camp

Rich,
Sorry about all the responses, but sometimes it happens. Hopefully
you've fixed the clicking into the field problem with my revised solution.
Regarding the spaces being allowed, I'm afraid that's the nature of the
the beast when dealing with InputMasks. The "a" allows spaces (tested in
A97), and I could find no solution in the newsgroups to solve this through
InputMasking alone.
Another problem is that your values really don't have a "set" format...
like a phone number or SSN. Input Masks are only advantageous on set
formats. AAAAAAA would work if you always required 7 characters...

Try using ValidationRule...
InStr([DOC]," ")=0
OR...
Use the BeforeUpdate event of your field to trap any spaces.
If Instr(YourField," ") Then
Msgbox "No Spaces Allowed
Cancel = True
YourField.Undo
End Sub
If that doesn't work out for you, please feel free try a completely New
post with just that question. I think you won't get a Mask solution... but
perhaps some other solutions you can consider.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


Rich1234 said:
Thanks for your quick reply Al.
I tried your code (in VBA on the OnClick event)
It doesn't stop the field being selected midway when you click it. This
is
on a field which is not a date but a series of characters (numbers and
letters)
I've just found out that the original mask alone does not automatically
include spaces in the first characters if the user clicks midway in the
field. It just says "The value you entered isn't appropriate for the
input
mask" and you have to enter from the start of the field.

So there are still 2 problems:
1) the user can still click midway in the field
2) the user can input spaces anywhere after the first character if they
want
(and I need to prevent spaces being input)

em is spaces... the user can still input spaces in the field, even though
"a" is specified. The code you gave doesn't seem to have fixed this.

I also need to find a solution for the same problem in a short date field.

Please help if you can!
Thank you
Rich

Al Camp said:
Rich,
Use the OnClick event for your date field with this code (ex.
ShortDate
field)
[YourField].SelLength = 8
Adjust the 8 to suit your format. That should select the whole date
format
if you mouse click into the field, and tabbing will work as always.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Rich1234 said:
Hi

I'm using an input mask on a field. The mask is
Aaaaaaa (so the last 6 characters are optional.)
The mask is set up so that the underscore character appears for every
character in the mask, denoting the field length (this includes the
optional
characters.)
The problem is this: if a user clicks on the field on a form (rather
than
tabbing to it,) if they don't click on the very far left of the field,
the
cursor "lands" somewhere between the start and end of the field which
is
very
fiddly for data input. The user will either have to use the left arrow
key
to go to the start of the field... or, even worse, they might not even
realise that they're not at the start of the field and type in a short
entry
(maybe 3 characters) midway in the field!

How can I prevent this? Hopefully users will tab to the field but I
need
to
sort this so they can't click somewhere in the middle.

Also I've just found that when you use "a" in a mask, it permits a
space
to
be entered! Is there any way that you can specify a mask for an
optional
character (either letter or digit) so that it cannot be a space? I
need
to
ensure a user doesn't enter any gaps between characters in the field.

Can you help?
TIA if you can

Rich
 
G

Guest

Hi Al
Thanks for your replies. Good lateral thinking! The click now always goes
to the far left of the field. Nice one!
I tried the Validation rule... it works. I also tried the code you sent but
get the error "Compile Error: Block If without End If" . ..this opens up the
debugger so there's something there VBA doesn't like.

I've just changed the onclick event to your new suggestion. Before it
was:[VRM].SelLength=7

Thanks Al

Rich


Al Camp said:
Also... Copy and Paste the code you wrote on the OnClick event into your
reply.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Al Camp said:
Rich,
Use the OnClick event for your date field with this code (ex. ShortDate
field)
[YourField].SelLength = 8
Adjust the 8 to suit your format. That should select the whole date
format if you mouse click into the field, and tabbing will work as always.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Rich1234 said:
Hi

I'm using an input mask on a field. The mask is
Aaaaaaa (so the last 6 characters are optional.)
The mask is set up so that the underscore character appears for every
character in the mask, denoting the field length (this includes the
optional
characters.)
The problem is this: if a user clicks on the field on a form (rather
than
tabbing to it,) if they don't click on the very far left of the field,
the
cursor "lands" somewhere between the start and end of the field which is
very
fiddly for data input. The user will either have to use the left arrow
key
to go to the start of the field... or, even worse, they might not even
realise that they're not at the start of the field and type in a short
entry
(maybe 3 characters) midway in the field!

How can I prevent this? Hopefully users will tab to the field but I need
to
sort this so they can't click somewhere in the middle.

Also I've just found that when you use "a" in a mask, it permits a space
to
be entered! Is there any way that you can specify a mask for an optional
character (either letter or digit) so that it cannot be a space? I need
to
ensure a user doesn't enter any gaps between characters in the field.

Can you help?
TIA if you can

Rich
 
G

Guest

Hi Al

I've just put a new post in about using this technique in a search combo..
it doesn't seem to work in this case

(see post under
Input Mask creating a problem in field for Search Combo
in Access Forms)

Thanks
Rich
Al Camp said:
Also... Copy and Paste the code you wrote on the OnClick event into your
reply.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Al Camp said:
Rich,
Use the OnClick event for your date field with this code (ex. ShortDate
field)
[YourField].SelLength = 8
Adjust the 8 to suit your format. That should select the whole date
format if you mouse click into the field, and tabbing will work as always.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Rich1234 said:
Hi

I'm using an input mask on a field. The mask is
Aaaaaaa (so the last 6 characters are optional.)
The mask is set up so that the underscore character appears for every
character in the mask, denoting the field length (this includes the
optional
characters.)
The problem is this: if a user clicks on the field on a form (rather
than
tabbing to it,) if they don't click on the very far left of the field,
the
cursor "lands" somewhere between the start and end of the field which is
very
fiddly for data input. The user will either have to use the left arrow
key
to go to the start of the field... or, even worse, they might not even
realise that they're not at the start of the field and type in a short
entry
(maybe 3 characters) midway in the field!

How can I prevent this? Hopefully users will tab to the field but I need
to
sort this so they can't click somewhere in the middle.

Also I've just found that when you use "a" in a mask, it permits a space
to
be entered! Is there any way that you can specify a mask for an optional
character (either letter or digit) so that it cannot be a space? I need
to
ensure a user doesn't enter any gaps between characters in the field.

Can you help?
TIA if you can

Rich
 
A

Al Camp

Rich,
The code I sent you needs and End If. This should be correct...

Use the BeforeUpdate event of your field to trap any spaces.
If Instr(YourField," ") Then
Msgbox "No Spaces Allowed
Cancel = True
YourField.Undo
End If ' <<Add this - when missing causes If without End If
error

Yes, the Validation check for spaces works just as well...

I'll try to take a look at the combo problem. Someone else may pick
that up...
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions




Rich1234 said:
Hi Al

I've just put a new post in about using this technique in a search combo..
it doesn't seem to work in this case

(see post under
Input Mask creating a problem in field for Search Combo
in Access Forms)

Thanks
Rich
Al Camp said:
Also... Copy and Paste the code you wrote on the OnClick event into your
reply.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Al Camp said:
Rich,
Use the OnClick event for your date field with this code (ex.
ShortDate
field)
[YourField].SelLength = 8
Adjust the 8 to suit your format. That should select the whole date
format if you mouse click into the field, and tabbing will work as
always.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Hi

I'm using an input mask on a field. The mask is
Aaaaaaa (so the last 6 characters are optional.)
The mask is set up so that the underscore character appears for every
character in the mask, denoting the field length (this includes the
optional
characters.)
The problem is this: if a user clicks on the field on a form (rather
than
tabbing to it,) if they don't click on the very far left of the field,
the
cursor "lands" somewhere between the start and end of the field which
is
very
fiddly for data input. The user will either have to use the left
arrow
key
to go to the start of the field... or, even worse, they might not even
realise that they're not at the start of the field and type in a short
entry
(maybe 3 characters) midway in the field!

How can I prevent this? Hopefully users will tab to the field but I
need
to
sort this so they can't click somewhere in the middle.

Also I've just found that when you use "a" in a mask, it permits a
space
to
be entered! Is there any way that you can specify a mask for an
optional
character (either letter or digit) so that it cannot be a space? I
need
to
ensure a user doesn't enter any gaps between characters in the field.

Can you help?
TIA if you can

Rich
 

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