TinkerMan
Dooh!
- Local time
- Today, 14:32
- Joined
- Jan 12, 2005
- Messages
- 35
Hi 
I though this was going to be really simple, but it was not. Maybe I'm overlooking something really simple (which will explain the lack of posts I found on it).
Consider a table with col1, col2, col3 etc. In a query you want to decide which column to use runtime i.e:
select colx, coly, whichColToUse(xyz) as specialColumn from z;
The idea is that whichColToUse might return "col2". If I do this, I get a column with the values "col2". Is there a way to use an expression to determine which column name to select, i.e make the selected column dynamic?
I know this is simple in VB, as the query is a string, but I cannot use VB for this (I assume), because I need to construct the final query for the form in VB. I think it will be a bit messy to select in VB from another query defined in VB.
To complicate matters, the underlaying query need a parameter, so when I tried a DLOOKUP, it failed.
Any input appreciated.
I though this was going to be really simple, but it was not. Maybe I'm overlooking something really simple (which will explain the lack of posts I found on it).
Consider a table with col1, col2, col3 etc. In a query you want to decide which column to use runtime i.e:
select colx, coly, whichColToUse(xyz) as specialColumn from z;
The idea is that whichColToUse might return "col2". If I do this, I get a column with the values "col2". Is there a way to use an expression to determine which column name to select, i.e make the selected column dynamic?
I know this is simple in VB, as the query is a string, but I cannot use VB for this (I assume), because I need to construct the final query for the form in VB. I think it will be a bit messy to select in VB from another query defined in VB.
To complicate matters, the underlaying query need a parameter, so when I tried a DLOOKUP, it failed.
Any input appreciated.