G
Guest
Greetings! I am querying linked Oracle tables from Access 2000. One of the
tables that I am querying has a new column added to the structure every month
to record end of month data (terrible design, but I didn't build it). I need
to sum all of the columns using SQL for each record when I run my query. I
haven't been able to figure out a way to tell SQL to "sum all of the columns
starting at column three to the last column in the row" in such a way that it
will work without modification the next month when another column is added.
What I would like to do is to create a function in VBA that could look at
the table structure, determine the number of columns, run the appropriate
query to sum all of the columns, and return the result set to the SQL code as
the result of subquery. However, I can't seem to figure out how to call a VBA
function from SQL. Can this be done?
Or does someone have another idea? Ideally, I could do the whole thing
without VBA at all.
Thanks in advance for your help!
tables that I am querying has a new column added to the structure every month
to record end of month data (terrible design, but I didn't build it). I need
to sum all of the columns using SQL for each record when I run my query. I
haven't been able to figure out a way to tell SQL to "sum all of the columns
starting at column three to the last column in the row" in such a way that it
will work without modification the next month when another column is added.
What I would like to do is to create a function in VBA that could look at
the table structure, determine the number of columns, run the appropriate
query to sum all of the columns, and return the result set to the SQL code as
the result of subquery. However, I can't seem to figure out how to call a VBA
function from SQL. Can this be done?
Or does someone have another idea? Ideally, I could do the whole thing
without VBA at all.
Thanks in advance for your help!