Real Wally
Registered User.
- Local time
- Today, 08:40
- Joined
- Jan 28, 2003
- Messages
- 107
Hi All,
I'm working on a crosstable qry that should compare records of various companies in a variable (but defined) period
The form has 2 text fields to define the period (txtdate1 and textdate2). That works fine.
I can also combine the period criteria with a company criteria by manually ading the company name but what doesn't work is when I select the company using a combobox.
To select for the company in the qry criteria I'm using the same criteria as I do for a selection qry:
([forms]![frmName]![cboboxname]
When I copy the expression above into the criteria of a crosstable qry I get an error. (not a valid fieldname or expression)
Anybody any suggestion??
Here's the whole code:
PARAMETERS [forms]![frmFormsAndReports_Period]![txtdate1] Short, [forms]![frmFormsAndReports_Period]![txtdate2] Short;
TRANSFORM Count(tblPatents.PriorityDate) AS CountOfPriorityDate
SELECT [Company_Short] & "-" & [area] AS lbl
FROM tblArea INNER JOIN (tblCompanies INNER JOIN tblPatents ON tblCompanies.CompanyID = tblPatents.CompanyID) ON tblArea.AreaID = tblPatents.AreaID
WHERE (((tblCompanies.Company)=[forms]![frmFormsAndReports_Period]![ChooseCompany]) AND ((Year([PriorityDate])) Between [forms]![frmFormsAndReports_Period]![txtdate1] And [forms]![frmFormsAndReports_Period]![txtdate2]))
GROUP BY [Company_Short] & "-" & [area], tblCompanies.Company_Short
PIVOT Year([PriorityDate]);
I'm working on a crosstable qry that should compare records of various companies in a variable (but defined) period
The form has 2 text fields to define the period (txtdate1 and textdate2). That works fine.
I can also combine the period criteria with a company criteria by manually ading the company name but what doesn't work is when I select the company using a combobox.
To select for the company in the qry criteria I'm using the same criteria as I do for a selection qry:
([forms]![frmName]![cboboxname]
When I copy the expression above into the criteria of a crosstable qry I get an error. (not a valid fieldname or expression)
Anybody any suggestion??
Here's the whole code:
PARAMETERS [forms]![frmFormsAndReports_Period]![txtdate1] Short, [forms]![frmFormsAndReports_Period]![txtdate2] Short;
TRANSFORM Count(tblPatents.PriorityDate) AS CountOfPriorityDate
SELECT [Company_Short] & "-" & [area] AS lbl
FROM tblArea INNER JOIN (tblCompanies INNER JOIN tblPatents ON tblCompanies.CompanyID = tblPatents.CompanyID) ON tblArea.AreaID = tblPatents.AreaID
WHERE (((tblCompanies.Company)=[forms]![frmFormsAndReports_Period]![ChooseCompany]) AND ((Year([PriorityDate])) Between [forms]![frmFormsAndReports_Period]![txtdate1] And [forms]![frmFormsAndReports_Period]![txtdate2]))
GROUP BY [Company_Short] & "-" & [area], tblCompanies.Company_Short
PIVOT Year([PriorityDate]);