A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Formatting a text box on a form



 
 
Thread Tools Display Modes
  #1  
Old January 4th, 2007, 07:13 PM posted to microsoft.public.access.forms
Rush
external usenet poster
 
Posts: 10
Default Formatting a text box on a form

I have a text box that a user simply has to enter numbers and the number is
automatically formatted like this "9999-99-999". However, when I look at the
table, the dashes do not appear. Does anyone have any suggestions as to how
to make the dashes appear in the table? Thank you!
  #2  
Old January 4th, 2007, 07:27 PM posted to microsoft.public.access.forms
Wayne-I-M
external usenet poster
 
Posts: 3,674
Default Formatting a text box on a form

Hi

Of course you "could" simply copy the formating from the form into the table
design 0000-00-000 but what would be the point.

The only person (or people) who should ever look at the table (either in
design view or in normal view) are the developer or administrator and both of
these will know what the field contains and what it does.

For everything else you can simply format the control (form/query/report) as
and when you need it.

Another reason for "not" formating the field in the table is that you "may"
want to show the information in another format one day - maybe not now but
you "may".

So I would leave the table to simply hold the data and not bother about
formating this number field.

Hope this helps
--
Wayne
Manchester, England.



"Rush" wrote:

I have a text box that a user simply has to enter numbers and the number is
automatically formatted like this "9999-99-999". However, when I look at the
table, the dashes do not appear. Does anyone have any suggestions as to how
to make the dashes appear in the table? Thank you!

  #3  
Old January 4th, 2007, 07:41 PM posted to microsoft.public.access.forms
[email protected]
external usenet poster
 
Posts: 6
Default Formatting a text box on a form

Wayne has is it dead on.

The data in the table shoud be just that, pure data. There is no need
for formatting. In fact, the larger the database gets, those extra
dashes begin to count against disk space as well. A ten digit
telephone number is actually stored as 12 characters instead of 10.

Making the phone number easily readable should be done in the forms and
reports, as this will not require any additional bytes from the
database. Those forms and reports are how the data is presented to the
users as information. It is there that the formatting should take
place.


If you insist on putting the dashes in the table itself aheem goto
the table design view. (The phone number field should be a text field
BTW - since no math is ever really to be done on a phone number - in
the rare case that it is, you can cast the text to a number at that
point - but I digress........)

In the field properties, add an input mask such as !000\-000\-0000;;_
or !\(999") "000\-0000;;_

Access actually has a drop down list that opens a wizard that will
assist in the process.

  #4  
Old January 4th, 2007, 07:46 PM posted to microsoft.public.access.forms
Rush
external usenet poster
 
Posts: 10
Default Formatting a text box on a form

Well, the reason for the formatting is because we have to enter this
information twice, once by scanning and once by hand and compare the two.
Since the scanned data has dashes in the ID number, I wanted to keep it
consistent so I don't get a bunch of errors when I compare the two. I think
your first paragraph answered my question. Thanks!

"Wayne-I-M" wrote:

Hi

Of course you "could" simply copy the formating from the form into the table
design 0000-00-000 but what would be the point.

The only person (or people) who should ever look at the table (either in
design view or in normal view) are the developer or administrator and both of
these will know what the field contains and what it does.

For everything else you can simply format the control (form/query/report) as
and when you need it.

Another reason for "not" formating the field in the table is that you "may"
want to show the information in another format one day - maybe not now but
you "may".

So I would leave the table to simply hold the data and not bother about
formating this number field.

Hope this helps
--
Wayne
Manchester, England.



"Rush" wrote:

I have a text box that a user simply has to enter numbers and the number is
automatically formatted like this "9999-99-999". However, when I look at the
table, the dashes do not appear. Does anyone have any suggestions as to how
to make the dashes appear in the table? Thank you!

  #5  
Old January 4th, 2007, 07:57 PM posted to microsoft.public.access.forms
Rush
external usenet poster
 
Posts: 10
Default Formatting a text box on a form

I appreciate your suggestion. Its not a phone number, but an ID number. I
have a table that reads from scanned information that has dashes in the ID
number, and a table where this information is typed in. For ease of
comparing, I want to put dashes in the one where its typed in.

" wrote:

Wayne has is it dead on.

The data in the table shoud be just that, pure data. There is no need
for formatting. In fact, the larger the database gets, those extra
dashes begin to count against disk space as well. A ten digit
telephone number is actually stored as 12 characters instead of 10.

Making the phone number easily readable should be done in the forms and
reports, as this will not require any additional bytes from the
database. Those forms and reports are how the data is presented to the
users as information. It is there that the formatting should take
place.


If you insist on putting the dashes in the table itself aheem goto
the table design view. (The phone number field should be a text field
BTW - since no math is ever really to be done on a phone number - in
the rare case that it is, you can cast the text to a number at that
point - but I digress........)

In the field properties, add an input mask such as !000\-000\-0000;;_
or !\(999") "000\-0000;;_

Access actually has a drop down list that opens a wizard that will
assist in the process.


  #6  
Old January 4th, 2007, 08:06 PM posted to microsoft.public.access.forms
[email protected]
external usenet poster
 
Posts: 6
Default Formatting a text box on a form

Another alternative (and again, the preferable way, not necessarily the
easiest though) would be to write code that would strip out the dashes
in the scanned in fields using string manipulation.

scannedNumber = Replace(scannedNumber.value, "-", "")

Another way would be to using the replace function in a SQL query.

SELECT Name, Phone, Replace(fax,"-","") AS Fax
FROM tableName
WHERE Phone Fax
;

  #7  
Old January 4th, 2007, 08:20 PM posted to microsoft.public.access.forms
[email protected]
external usenet poster
 
Posts: 6
Default Formatting a text box on a form

Sorry - just read your last....so ignore mine as appropriate.

The concept is the same, whether it is ID or Phone or whatever,
especially the SQL script. It makes it even easier by only displaying
those fields that are not equivalent.

Using more string manipulation, you can insert the dashes in a SQL
Query just as easily as you remove them.

SELECT Name, Mid(scanned_ID,1,3) & "-" & Mid(scanned_ID,4,3) & "-" &
Mid(scanned_ID,7,4) As idScanned, idManual
FROM tableName

I think the point here is that it can be done either on a table level
or using forms, reports or coding to present the raw data in a way that
suits your needs.




Rush wrote:
I appreciate your suggestion. Its not a phone number, but an ID number. I
have a table that reads from scanned information that has dashes in the ID
number, and a table where this information is typed in. For ease of
comparing, I want to put dashes in the one where its typed in.


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:21 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.