Thanks for responding.
I don't want to use codes anymore, words are better. And not using a "type"
table, using Value List and hard coded values.
Well, a Value List will work, but if you'll ever be changing them, you
then have a maintenance hassle. A small Table makes a good rowsource
for a combo box as well, and is easier to maintain. Your choice
though!
I don't understand what you wrote re: switch.
Switch() is a builtin function in Access VBA. Type Ctrl-G to open the
VBA editor (just to get connected to the correct Help file) and select
Help, and search for Switch() for details. Basically it takes
arguments in pairs; goes left to right; and when the first member of a
pair is True it returns the second.
Part of what makes this difficult is that I am migrating a flat file to a
relational table. The flat file is "Transaction" with 30 columns A#, T#, D#
where A = amount, T = Type and D= Date. I need to put this into rows. ugh!
So, I am writing an append query for each group (ATD), setting criteria for
the various types, (D,R, etc.) and then another column as an expression to
put the textual description in.
A "Normalizing Union Query" is a very slick way to do this all in one
swell foop, without needing to set criteria at all.
Let's say Transaction has a field TransID and fields A1 through A30,
T1 through T30 and so on; and you want to append this data to a
normalized table with fields TransID, SeqNo (1 to 30), Amount,
TransType, and TransDate. You can create a Query in the SQL window:
SELECT Transaction.TransID, (1) AS SeqNo, [A1] AS Amount,
Switch([T1] = "D", "Deposit", [T1] = "W", "Withdrawal",
[T1] = "P", "Payment", [T1] = "C", "Correction",
<etc as many pairs as needed>) AS TranType,
[D1] AS TransDate)
WHERE [A1] IS NOT NULL
UNION
SELECT Transaction.TransID, (2) AS SeqNo, [A2] AS Amount,
Switch([T2] = "D", "Deposit", [T2] = "W", "Withdrawal",
[T2] = "P", "Payment", [T2] = "C", "Correction",
<etc as many pairs as needed>) AS TranType,
[D2] AS TransDate)
WHERE [A2] IS NOT NULL
UNION
<etcetera, all 30 sets of fields>
Save this Query and then base a UNION query upon it.
John W. Vinson[MVP]