String Manipulation in Access 2003

  • Thread starter Thread starter news.microsoft.com
  • Start date Start date
N

news.microsoft.com

Good Morning All

I am quite a novice at coding for access, but am trying to learn as much as
i can in works time and they have let me loose on creating a company
database.

I have searched high and low for the answer to this question, and i'm sure
its looking me straight in the face, but i cannot see it.

Question :- I have two fields in my database, [company name] and [prefix]

now the [prefix] field is just the first two characters of the [company
name] field. i need a way to extract the first two charcters and pop them in
the [prefix] filed.

in the old stly basic, there used to be a command STR$(x) which could
extract x number of characters from a string. Is there an equivilent in
Access.

I'm sure one of you prfessionals will have the answer straight away (thats
my bit of flattery for the day), and i thank you in advanve for your answer.
 
Left$([company name], 2)

The Str() function merely converts a number to a string. It puts a space in
front of positive numbers to make them line up with negative numbers. That
probably made sense in the days of text-mode displays, but it's rarely what
is wanted today, so we usually use CStr() instead, which does the same job
but without the leading space.
 
Many thanks for that, it has been appreciated.


Brendan Reynolds said:
Left$([company name], 2)

The Str() function merely converts a number to a string. It puts a space
in front of positive numbers to make them line up with negative numbers.
That probably made sense in the days of text-mode displays, but it's
rarely what is wanted today, so we usually use CStr() instead, which does
the same job but without the leading space.

--
Brendan Reynolds (MVP)

news.microsoft.com said:
Good Morning All

I am quite a novice at coding for access, but am trying to learn as much
as i can in works time and they have let me loose on creating a company
database.

I have searched high and low for the answer to this question, and i'm
sure its looking me straight in the face, but i cannot see it.

Question :- I have two fields in my database, [company name] and [prefix]

now the [prefix] field is just the first two characters of the [company
name] field. i need a way to extract the first two charcters and pop them
in the [prefix] filed.

in the old stly basic, there used to be a command STR$(x) which could
extract x number of characters from a string. Is there an equivilent in
Access.

I'm sure one of you prfessionals will have the answer straight away
(thats my bit of flattery for the day), and i thank you in advanve for
your answer.
 
Back
Top