Direct Issue:
I'm trying to get the column count of a dynamic crosstab query in VBA code, but while the code is running, the crosstab query clears, so Fields.Count = 0. This issue happens when I run any VBA code (trigger by button click or combo box update). Is there anyway to get a dynamic crosstab query to actually contain data while VBA code is running?
Bigger situation:
I'm trying to force a subform to use my dynamic crosstab query as it's source object (Normally one would get the "Can't use non fixed column crosstab as source object" error). I figure I might be able to do that by compiling a string of column names and then forming a new query with the column names hard coded in. The appropriate query is formed by selecting an option from a combo box on the form (an 'on update' even triggers and forms the SQL statement in VBA code), and I can open that query and view it just fine after that code finishes, but when code runs from a button click (even If I put a debug breakpoint before the code refers to any queries) the query goes blank until that code finishes, thus my problem.
The number of columns vary depending on the user choice in the combo box. Both of my dynamic queries will clear out (even though one has nothing to do with the code being run). I've done a lot of searching, but I couldn't find any work-arounds for this. Could I create a whole new table based on my query? I'm not seeing how that would work.
I can post my code if it'll help, but I figure i'll not cram this first post with 71 line of code.
Thanks in advance.