Number Formatting

C

Craig

I need to automatically add an asterix to the beginning
and to the end of every number that is entered into my
database. Example *123456789*

I have tried doing !"*" in the "Format" of the required
field in my table. This results in an asterix at the
beginning of my number but I cannot work out how to put
one at the end of the number. Please help!

Thanks

Craig
 
J

Jeff Boyce

Craig

Are you saying you need to 'display' each number surrounded by asterisks, or
that you want to store a text string that starts and ends with an asterisk,
and has only digit characters in the middle?

Use a text field to store the latter version, and use the control's
AfterUpdate event on your form to add asterisks to entered digits.

As for the former, I haven't a clue. I tried using "!*####!*", but Access
doesn't seem to do what I (you) had in mind. Have you checked Google.com on
this topic?
 
A

Arvin Meyer

It looks like you are preparing a numeric field to accept a barcode. If this
is the case, you can add the number temporarily for the reader to use, then
discard it once the value has bee read. Just use concatenation as the
controlsource for output (labels, etc.) like:

= Chr(42) & [MyNumber] & Chr(42)

Use of Chr(42) (which is the asterisk) will keep the expression service
from evaluating it expression as a wildcard. When read back, use the Left
and Right functions to strip off the first and last characters.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
C

Craig

Hi Arvin,

Many thanks for your reply, You hit the nail on the head
re my motives..Barcode.

I am trying to call up a record from a table and print it
as a report with a barcode on it. As you probably know
you need an asterix at either end of the barcode in order
for it to be readable.

Where in the database would I create my expression to add
these asterixes, Would it be the report or the table
where the data is stored?

Apologies if I am sounding a bit dimm, I am a little out
of my depth on this one.

Regards

Craig

-----Original Message-----
It looks like you are preparing a numeric field to accept a barcode. If this
is the case, you can add the number temporarily for the reader to use, then
discard it once the value has bee read. Just use concatenation as the
controlsource for output (labels, etc.) like:

= Chr(42) & [MyNumber] & Chr(42)

Use of Chr(42) (which is the asterisk) will keep the expression service
from evaluating it expression as a wildcard. When read back, use the Left
and Right functions to strip off the first and last characters.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access

I need to automatically add an asterix to the beginning
and to the end of every number that is entered into my
database. Example *123456789*

I have tried doing !"*" in the "Format" of the required
field in my table. This results in an asterix at the
beginning of my number but I cannot work out how to put
one at the end of the number. Please help!

Thanks

Craig


.
 
A

Arvin Meyer

You can use the textbox on the report itself, or the underlying query. To
use the textbox, use the expression I gave you, below:

= Chr(42) & [MyField] & Chr(42)

For the query, add a column with the expression similar to:

Barcode: Chr(42) & [MyField] & Chr(42)
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access Downloads
http://www.datastrat.com
http://www.mvps.org/access

Craig said:
Hi Arvin,

Many thanks for your reply, You hit the nail on the head
re my motives..Barcode.

I am trying to call up a record from a table and print it
as a report with a barcode on it. As you probably know
you need an asterix at either end of the barcode in order
for it to be readable.

Where in the database would I create my expression to add
these asterixes, Would it be the report or the table
where the data is stored?

Apologies if I am sounding a bit dimm, I am a little out
of my depth on this one.

Regards

Craig

-----Original Message-----
It looks like you are preparing a numeric field to accept a barcode. If this
is the case, you can add the number temporarily for the reader to use, then
discard it once the value has bee read. Just use concatenation as the
controlsource for output (labels, etc.) like:

= Chr(42) & [MyNumber] & Chr(42)

Use of Chr(42) (which is the asterisk) will keep the expression service
from evaluating it expression as a wildcard. When read back, use the Left
and Right functions to strip off the first and last characters.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access

I need to automatically add an asterix to the beginning
and to the end of every number that is entered into my
database. Example *123456789*

I have tried doing !"*" in the "Format" of the required
field in my table. This results in an asterix at the
beginning of my number but I cannot work out how to put
one at the end of the number. Please help!

Thanks

Craig


.
 
Top