Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parameterized cross tab query 1

Status
Not open for further replies.

Pampers

Technical User
Apr 7, 2004
1,300
AN
Hi everyone,
I have a cross tab query with parameters (startdate & enddate). All ok. Now I trie to set the parameters to refer to a form, so the input is more user friendly (dates set with a calendar). But that doesn't seem to work... Message is: "Engine does not recognize ... as a valid field expression..."

Any suggestions.



Pampers [afro]
Keeping it simple can be complicated
 
Could you please post your actual SQL code ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Code:
PARAMETERS startdate DateTime, enddate DateTime;
TRANSFORM Count(lstContainerTypes.ContainerCode) AS CountOfContainerCode
SELECT lstPorts.PortRegion
FROM tblVoyageNo INNER JOIN ((tblContainers INNER JOIN lstContainerTypes ON tblContainers.ContainerTypeID = lstContainerTypes.ContainerTypeID) INNER JOIN ((lstPorts INNER JOIN tblBolImport ON lstPorts.PortID = tblBolImport.PortOfLoadID) INNER JOIN tblPackagesImp ON tblBolImport.BolImportID = tblPackagesImp.BolImportID) ON tblContainers.ContainerID = tblPackagesImp.ContainerID) ON tblVoyageNo.VoyageID = tblBolImport.VoyageID
WHERE (((tblBolImport.PartialContainerFollow)=False) AND ((tblBolImport.BolType)="import"))
GROUP BY lstPorts.PortRegion
PIVOT lstContainerTypes.ContainerType;

Pampers [afro]
Keeping it simple can be complicated
 
In your PARAMETERS instruction, replace startdate and enddate with the full qualified name of the controls, eg:
[Forms]![your form]![startdate control]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi PHV,
Very Nice. Works great.


And off course you are always welcome to stay our place at curacao! Plus free diving lessons.


Pampers [afro]
Keeping it simple can be complicated
 
Forgot to post the working code:

Code:
PARAMETERS [Forms]![DialogPrintAnalysis]![StartDate] DateTime, [Forms]![DialogPrintAnalysis]![EndDate] DateTime;
TRANSFORM Count(lstContainerTypes.ContainerCode) AS CountOfContainerCode
SELECT lstPorts.PortRegion
FROM tblVoyageNo INNER JOIN ((tblContainers INNER JOIN lstContainerTypes ON tblContainers.ContainerTypeID = lstContainerTypes.ContainerTypeID) INNER JOIN ((lstPorts INNER JOIN tblBolImport ON lstPorts.PortID = tblBolImport.PortOfLoadID) INNER JOIN tblPackagesImp ON tblBolImport.BolImportID = tblPackagesImp.BolImportID) ON tblContainers.ContainerID = tblPackagesImp.ContainerID) ON tblVoyageNo.VoyageID = tblBolImport.VoyageID
WHERE (((tblBolImport.PartialContainerFollow)=False) AND ((tblBolImport.BolType)="import") AND ((tblVoyageNo.EtaDay) Between [Forms]![DialogPrintAnalysis]![StartDate] And [Forms]![DialogPrintAnalysis]![EndDate]))
GROUP BY lstPorts.PortRegion
PIVOT lstContainerTypes.ContainerType;


Pampers [afro]
Keeping it simple can be complicated
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top