How do you separate the contents of one field into several fields? Sort of
like un-concatenating. I have one field that contains data from several
fields, there's a common delimiter, but how do I code that into a query or
form field?
Queries in Access can call VBA functions, so if I have a column with stuff
like this:
value1;value2;value3
I can use the Instr() function to locate the ; delimiter:
Instr([myColumn], ";")
....and use that position value to call Left$() to get value1:
Left$([myColumn], Instr([myColumn], ";") - 1)
....get the position of the next ; with Instr() and pass them to Mid$() to
get value2:
Mid$([myColumn], Instr([myColumn], ";") + 1, Instr(Instr([myColumn], ";") +
1[myColumn], ";") - Instr([myColumn], ";")) ''This is air code. You'll
need to monkey with it a bit
and then pass the position of the 2nd delimiter to Right$():
Right$([myColumn], Len([MyColumn]) - Instr(Instr([myColumn], ";") +
1[myColumn], ";") )
It's not pretty, but it should work.
Another thing that you could do to get there by cheating is to use the
export wizard to export the table using the same delimiter format as what's
in your table data, then re-import the file to a new table. The extra
values will then come back in as separate columns, and you will likely have
two empty columns, one just before and one just after the new ones from your
old composite values.
--
Peace & happy computing,
Mike Labosh, MCSD
"Mr. McKittrick, after very careful consideration, I have
come to the conclusion that this new system SUCKS!"
~~ General Barringer ~~