J
John
I have a form with the following selections a user may select:
1. Date format: "Ordinal" or "Calendar"
2. Group By: "JV ID","CMIS ID", or "Craft"
3. Value to show: "PF", "Actual Cost", "Earned Cost", "Quantity", "Actual
Hours", "Earned Hours" (this list could grow)
What I would like to do is create one cross tab query that creates the query
based on the values the user selects. Given the available selections, this
could be a total of 30 different crosstab queries. I don't want to create 30
different queries and then do a long VBA "Selelect" statement to run the
appropreate query. Is there an easy way to handle this? I have tried the
following and I get an error "The Microsoft Jet database engin does not
recongize 'forms!frmGntOpt!CmbDteFmt' as a valid field name or expresson."
Here's the code:
======
TRANSFORM
IIf(forms!frmGntOpt!cmbValues="PF",tblMonthly!pf_td,IIf(forms!frmGntOpt!cmbValues="Quantity",tblMonthly!quan_td,IIf(forms!frmGntOpt!cmbValues="Earned
Cost",tblMonthly!ebudgt_td,IIf(forms!frmGntOpt!cmbValues="Actual
Cost",tblMonthly!actualttd,IIf(forms!frmGntOpt!cmbValues="Earned
Hours",tblMonthly!whourerntd,tblMonthly!whouracttd))))) AS [Values]
SELECT IIf(forms!frmGntOpt!cmbGrpBy="CMIS
ID",tblActMap!Act,IIf(forms!frmGntOpt!cmbGrpBy="JV
ID",tblActMap!JVID,tblActMap!Srt3)) AS Description
FROM tblJVTitles RIGHT JOIN (tblCostOwners RIGHT JOIN (tblCMIS_Type RIGHT
JOIN (tblCMIS_Craft RIGHT JOIN (tblCMIS_Cat RIGHT JOIN ((tblMonthly LEFT JOIN
tblActMap ON tblMonthly.act = tblActMap.Act) LEFT JOIN tblProjInfo ON
tblMonthly.period = tblProjInfo.CMIS_Mo) ON tblCMIS_Cat.Str1 =
tblActMap.Srt1) ON tblCMIS_Craft.Srt3 = tblActMap.Srt3) ON tblCMIS_Type.Srt2
= tblActMap.Srt2) ON tblCostOwners.CO_Ini = tblActMap.CstOwnIni) ON
tblJVTitles.JVID = tblActMap.JVID
GROUP BY IIf(forms!frmGntOpt!cmbGrpBy="CMIS
ID",tblActMap!Act,IIf(forms!frmGntOpt!cmbGrpBy="JV
ID",tblActMap!JVID,tblActMap!Srt3))
ORDER BY IIf(forms!frmGntOpt!cmbGrpBy="CMIS
ID",tblActMap!Act,IIf(forms!frmGntOpt!cmbGrpBy="JV
ID",tblActMap!JVID,tblActMap!Srt3))
PIVOT
IIf(forms!frmGntOpt!CmbDteFmt="Calendar",tblProjInfo!Period_Dte,tblProjInfo!Period);
======
Thanks in advance!
1. Date format: "Ordinal" or "Calendar"
2. Group By: "JV ID","CMIS ID", or "Craft"
3. Value to show: "PF", "Actual Cost", "Earned Cost", "Quantity", "Actual
Hours", "Earned Hours" (this list could grow)
What I would like to do is create one cross tab query that creates the query
based on the values the user selects. Given the available selections, this
could be a total of 30 different crosstab queries. I don't want to create 30
different queries and then do a long VBA "Selelect" statement to run the
appropreate query. Is there an easy way to handle this? I have tried the
following and I get an error "The Microsoft Jet database engin does not
recongize 'forms!frmGntOpt!CmbDteFmt' as a valid field name or expresson."
Here's the code:
======
TRANSFORM
IIf(forms!frmGntOpt!cmbValues="PF",tblMonthly!pf_td,IIf(forms!frmGntOpt!cmbValues="Quantity",tblMonthly!quan_td,IIf(forms!frmGntOpt!cmbValues="Earned
Cost",tblMonthly!ebudgt_td,IIf(forms!frmGntOpt!cmbValues="Actual
Cost",tblMonthly!actualttd,IIf(forms!frmGntOpt!cmbValues="Earned
Hours",tblMonthly!whourerntd,tblMonthly!whouracttd))))) AS [Values]
SELECT IIf(forms!frmGntOpt!cmbGrpBy="CMIS
ID",tblActMap!Act,IIf(forms!frmGntOpt!cmbGrpBy="JV
ID",tblActMap!JVID,tblActMap!Srt3)) AS Description
FROM tblJVTitles RIGHT JOIN (tblCostOwners RIGHT JOIN (tblCMIS_Type RIGHT
JOIN (tblCMIS_Craft RIGHT JOIN (tblCMIS_Cat RIGHT JOIN ((tblMonthly LEFT JOIN
tblActMap ON tblMonthly.act = tblActMap.Act) LEFT JOIN tblProjInfo ON
tblMonthly.period = tblProjInfo.CMIS_Mo) ON tblCMIS_Cat.Str1 =
tblActMap.Srt1) ON tblCMIS_Craft.Srt3 = tblActMap.Srt3) ON tblCMIS_Type.Srt2
= tblActMap.Srt2) ON tblCostOwners.CO_Ini = tblActMap.CstOwnIni) ON
tblJVTitles.JVID = tblActMap.JVID
GROUP BY IIf(forms!frmGntOpt!cmbGrpBy="CMIS
ID",tblActMap!Act,IIf(forms!frmGntOpt!cmbGrpBy="JV
ID",tblActMap!JVID,tblActMap!Srt3))
ORDER BY IIf(forms!frmGntOpt!cmbGrpBy="CMIS
ID",tblActMap!Act,IIf(forms!frmGntOpt!cmbGrpBy="JV
ID",tblActMap!JVID,tblActMap!Srt3))
PIVOT
IIf(forms!frmGntOpt!CmbDteFmt="Calendar",tblProjInfo!Period_Dte,tblProjInfo!Period);
======
Thanks in advance!