Strings: Parsing data into other fields in the same table
Thanks for your help! I have one more question though
which you seemed to note. What do I do if for the code
isn't consistently four characters. What if two fields
fluctuate between having 1-2 and 3-4 characters
respectively?
-----Original Message-----
I hope I am understanding your question correctly.
Anyway, the following
will work if your field is consistently four
characters. On the After Update
event of your code field put the following:
Me.CodeYear = Left([code],1)
Me.CodeSeason = Mid([code],2,1)
Me.CodeMedia = Mid([code],3,1)
Me.CodeGenre = Right([code],1)
This will separate that four digit field into four
different fields (you
will have to use your own field names).
Hope this helps.
" wrote:
I am making a simple database and I was wondering how
can
the information from a field containing strings of
both
numbers and characters be broken and entered other
fields. I am dealing with a code that looks like this:
01MP, and has four parts. The first number refers to
the
year 2000, the second number refers the season of the
year (spring), the third to type of media (a
magazine),
and the fourth the genre (politics). I have a field
for
the code and fields for each of the four parts but I
was
wondering how I could automate the entry of the four
extra fields as the data is redundant.
.
|