Entering data one way, writing it to the db another...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to set up a form object (text box I imagine), such that when a
user enters 10 straight numerals, it is written to the table in the format
xxxx.xx.xx.xx

That is, I need the periods inserted, in those postions. How could this be
done?

Tariff codes, in case you're curious. : )

Tia
 
Ricter,
Try an InputMask of....
000.00.00.00;0;"N"
The user would enter 10 digits with no periods, but the digits and
periods would be stored in the table.
OR
Without an InputMask, the user would enter ten digits into the field,
(ex. [10Digs]) and then on the AfterUpdate event...
[10Digs] =Left([10Digs],4) & "." & Mid([10Digs],5,2) & "." &
Mid([10Digs],7,2) & "." & Right([10Digs],2)

The InputMask is the best solution, as it "requires" exactly 10 digits...
no more, no less. Less chance for entry errors.
 
Just a comment. It's important to understand that when you use an Input
Mask, it usually only changes how the data appears in the text box, not how
it's stored. While it may appear that your field holds 1234.56.78.90, by
default it actually only holds the value 1234567890. If that's the case, if
you were to have a query that prompted the user to enter a criteria for that
field, they'd have to enter 1234567890, not 1234.56.78.90.

You can override that behaviour by using 0 as the second parmater of the
InputMask. In other words, if you use an InputMask of 0000.00.00.00;0 then
what gets stored in the field will be 1234.56.78.90, and to match it in a
query you'd actually specify 1234.56.78.90.

Perhaps that's what Al was trying to accomplish by using "N" as the second
parameter, but it must be 0.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Al Camp said:
Ricter,
Try an InputMask of....
000.00.00.00;0;"N"
The user would enter 10 digits with no periods, but the digits and
periods would be stored in the table.
OR
Without an InputMask, the user would enter ten digits into the field,
(ex. [10Digs]) and then on the AfterUpdate event...
[10Digs] =Left([10Digs],4) & "." & Mid([10Digs],5,2) & "." &
Mid([10Digs],7,2) & "." & Right([10Digs],2)

The InputMask is the best solution, as it "requires" exactly 10
digits... no more, no less. Less chance for entry errors.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Ricter said:
I would like to set up a form object (text box I imagine), such that when
a
user enters 10 straight numerals, it is written to the table in the
format
xxxx.xx.xx.xx

That is, I need the periods inserted, in those postions. How could this
be
done?

Tariff codes, in case you're curious. : )

Tia
 
Douglas,
My Input mask was a typo...
I had
000.00.00.00;0;"N"
It should have been
0000.00.00.00;0;"N" (the 4 starting 0's)
This mask includes the second section ;0 to save the periods.
To be sure, I tested this. 1234567890 stores as 1234.56.78.90

Did I miss something?

Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Douglas J. Steele said:
Just a comment. It's important to understand that when you use an Input
Mask, it usually only changes how the data appears in the text box, not
how it's stored. While it may appear that your field holds 1234.56.78.90,
by default it actually only holds the value 1234567890. If that's the
case, if you were to have a query that prompted the user to enter a
criteria for that field, they'd have to enter 1234567890, not
1234.56.78.90.

You can override that behaviour by using 0 as the second parmater of the
InputMask. In other words, if you use an InputMask of 0000.00.00.00;0 then
what gets stored in the field will be 1234.56.78.90, and to match it in a
query you'd actually specify 1234.56.78.90.

Perhaps that's what Al was trying to accomplish by using "N" as the second
parameter, but it must be 0.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Al Camp said:
Ricter,
Try an InputMask of....
000.00.00.00;0;"N"
The user would enter 10 digits with no periods, but the digits and
periods would be stored in the table.
OR
Without an InputMask, the user would enter ten digits into the field,
(ex. [10Digs]) and then on the AfterUpdate event...
[10Digs] =Left([10Digs],4) & "." & Mid([10Digs],5,2) & "." &
Mid([10Digs],7,2) & "." & Right([10Digs],2)

The InputMask is the best solution, as it "requires" exactly 10
digits... no more, no less. Less chance for entry errors.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Ricter said:
I would like to set up a form object (text box I imagine), such that when
a
user enters 10 straight numerals, it is written to the table in the
format
xxxx.xx.xx.xx

That is, I need the periods inserted, in those postions. How could this
be
done?

Tariff codes, in case you're curious. : )

Tia
 
Another question then, and this has puzzled me for some time. Do I enter the
input mask for the control in table design, or form design? It appears I can
do either, though I did note that if it's done on the form side, the input
mask is visible when you start entering data.

Thanks

Douglas J. Steele said:
Just a comment. It's important to understand that when you use an Input
Mask, it usually only changes how the data appears in the text box, not how
it's stored. While it may appear that your field holds 1234.56.78.90, by
default it actually only holds the value 1234567890. If that's the case, if
you were to have a query that prompted the user to enter a criteria for that
field, they'd have to enter 1234567890, not 1234.56.78.90.

You can override that behaviour by using 0 as the second parmater of the
InputMask. In other words, if you use an InputMask of 0000.00.00.00;0 then
what gets stored in the field will be 1234.56.78.90, and to match it in a
query you'd actually specify 1234.56.78.90.

Perhaps that's what Al was trying to accomplish by using "N" as the second
parameter, but it must be 0.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Al Camp said:
Ricter,
Try an InputMask of....
000.00.00.00;0;"N"
The user would enter 10 digits with no periods, but the digits and
periods would be stored in the table.
OR
Without an InputMask, the user would enter ten digits into the field,
(ex. [10Digs]) and then on the AfterUpdate event...
[10Digs] =Left([10Digs],4) & "." & Mid([10Digs],5,2) & "." &
Mid([10Digs],7,2) & "." & Right([10Digs],2)

The InputMask is the best solution, as it "requires" exactly 10
digits... no more, no less. Less chance for entry errors.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Ricter said:
I would like to set up a form object (text box I imagine), such that when
a
user enters 10 straight numerals, it is written to the table in the
format
xxxx.xx.xx.xx

That is, I need the periods inserted, in those postions. How could this
be
done?

Tariff codes, in case you're curious. : )

Tia
 
Ooh. Sorry about that, Al. I missed the fact that you had ;0;"N" at the end:
I thought you had "N" as the 2nd parameter, not the 3rd.

Still, I thought it was important to point out to anyone reading that the
default behaviour for the InputMask is not to store the formatting
characters in the database, and to highlight that you had to do something to
make the formatting characters be stored.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Al Camp said:
Douglas,
My Input mask was a typo...
I had
000.00.00.00;0;"N"
It should have been
0000.00.00.00;0;"N" (the 4 starting 0's)
This mask includes the second section ;0 to save the periods.
To be sure, I tested this. 1234567890 stores as 1234.56.78.90

Did I miss something?

Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Douglas J. Steele said:
Just a comment. It's important to understand that when you use an Input
Mask, it usually only changes how the data appears in the text box, not
how it's stored. While it may appear that your field holds 1234.56.78.90,
by default it actually only holds the value 1234567890. If that's the
case, if you were to have a query that prompted the user to enter a
criteria for that field, they'd have to enter 1234567890, not
1234.56.78.90.

You can override that behaviour by using 0 as the second parmater of the
InputMask. In other words, if you use an InputMask of 0000.00.00.00;0 then
what gets stored in the field will be 1234.56.78.90, and to match it in a
query you'd actually specify 1234.56.78.90.

Perhaps that's what Al was trying to accomplish by using "N" as the second
parameter, but it must be 0.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Al Camp said:
Ricter,
Try an InputMask of....
000.00.00.00;0;"N"
The user would enter 10 digits with no periods, but the digits and
periods would be stored in the table.
OR
Without an InputMask, the user would enter ten digits into the field,
(ex. [10Digs]) and then on the AfterUpdate event...
[10Digs] =Left([10Digs],4) & "." & Mid([10Digs],5,2) & "." &
Mid([10Digs],7,2) & "." & Right([10Digs],2)

The InputMask is the best solution, as it "requires" exactly 10
digits... no more, no less. Less chance for entry errors.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

I would like to set up a form object (text box I imagine), such that when
a
user enters 10 straight numerals, it is written to the table in the
format
xxxx.xx.xx.xx

That is, I need the periods inserted, in those postions. How could this
be
done?

Tariff codes, in case you're curious. : )

Tia
 
Your right about that. I was a bit rushed, and missed that opportunity to
explain the masking parameters.
Thanks for backing up my post with your additional info...

Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


Douglas J Steele said:
Ooh. Sorry about that, Al. I missed the fact that you had ;0;"N" at the
end:
I thought you had "N" as the 2nd parameter, not the 3rd.

Still, I thought it was important to point out to anyone reading that the
default behaviour for the InputMask is not to store the formatting
characters in the database, and to highlight that you had to do something
to
make the formatting characters be stored.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Al Camp said:
Douglas,
My Input mask was a typo...
I had
000.00.00.00;0;"N"
It should have been
0000.00.00.00;0;"N" (the 4 starting 0's)
This mask includes the second section ;0 to save the periods.
To be sure, I tested this. 1234567890 stores as 1234.56.78.90

Did I miss something?

Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Douglas J. Steele said:
Just a comment. It's important to understand that when you use an Input
Mask, it usually only changes how the data appears in the text box, not
how it's stored. While it may appear that your field holds 1234.56.78.90,
by default it actually only holds the value 1234567890. If that's the
case, if you were to have a query that prompted the user to enter a
criteria for that field, they'd have to enter 1234567890, not
1234.56.78.90.

You can override that behaviour by using 0 as the second parmater of
the
InputMask. In other words, if you use an InputMask of 0000.00.00.00;0 then
what gets stored in the field will be 1234.56.78.90, and to match it in a
query you'd actually specify 1234.56.78.90.

Perhaps that's what Al was trying to accomplish by using "N" as the second
parameter, but it must be 0.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Ricter,
Try an InputMask of....
000.00.00.00;0;"N"
The user would enter 10 digits with no periods, but the digits and
periods would be stored in the table.
OR
Without an InputMask, the user would enter ten digits into the
field,
(ex. [10Digs]) and then on the AfterUpdate event...
[10Digs] =Left([10Digs],4) & "." & Mid([10Digs],5,2) & "." &
Mid([10Digs],7,2) & "." & Right([10Digs],2)

The InputMask is the best solution, as it "requires" exactly 10
digits... no more, no less. Less chance for entry errors.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

I would like to set up a form object (text box I imagine), such that when
a
user enters 10 straight numerals, it is written to the table in the
format
xxxx.xx.xx.xx

That is, I need the periods inserted, in those postions. How could this
be
done?

Tariff codes, in case you're curious. : )

Tia
 
Back
Top