rubbernilly
Programmer
Just wondering if there is some pre-built code to handle a querydef and parse out the SQL into [FieldName] and [Source]?
For instance, given the SQL of:
It would produce something along the lines of:
Obviously the all fields selector (i.e., "*") would be passing a bunch of fields that we wouldn't be able to parse except for by opening the query and accessing the fields, but I think for these purposes I don't think I would need it, as the source and query field would be the same (that is, the field name in the query would be the same in the table, so it doesn't matter to me). Mostly I want to snag the fields that are constructed on the fly. It doesn't have to do it in any particular way... array, dumping to a table via DAO... just so long as I can get at the list.
I'm hoping this has been done already, as parsing for commas will be problematic given their presence in various formulas (vba function argument lists, IIF() statements, etc.).
Thanks for any suggestions.
For instance, given the SQL of:
Code:
SELECT tblTable1.WidgetID, tblTable1.WidgetName, IIF(ISNULL(tblTable1.WidgetPrice),2.99, tblTable1.WidgetPrice) AS Price, tblTable1.WidgetReOrderQty AS OrderAmt, (Price * OrderAmt) AS WidgetPricePerOrder
FROM tblTable1;
It would produce something along the lines of:
Code:
QueryField Source
WidgetID tblTable1.WidgetID
WidgeName tblTable1.WidgetName
Price IIF(ISNULL(tblTable1.WidgetPrice),2.99, tblTable1.WidgetPrice)
OrderAmt tblTable1.WidgetReOrderQty
WidgetPricePerOrder (Price * OrderAmt)
Obviously the all fields selector (i.e., "*") would be passing a bunch of fields that we wouldn't be able to parse except for by opening the query and accessing the fields, but I think for these purposes I don't think I would need it, as the source and query field would be the same (that is, the field name in the query would be the same in the table, so it doesn't matter to me). Mostly I want to snag the fields that are constructed on the fly. It doesn't have to do it in any particular way... array, dumping to a table via DAO... just so long as I can get at the list.
I'm hoping this has been done already, as parsing for commas will be problematic given their presence in various formulas (vba function argument lists, IIF() statements, etc.).
Thanks for any suggestions.