Sure thanks, here it is:
*************************************
TRANSFORM Count(tblPatientDemographic.Gender) AS
CountOfGender
SELECT tblPatientTreatment.ProtocolID,
tblPatientTreatment.SubProtocolID,
tblPatientTreatment.ProtocolStudyNumber,
tblPatientDemographic.Gender,
tblPatientTreatment.Consultation
FROM tblPatientDemographic INNER JOIN tblPatientTreatment
ON tblPatientDemographic.PatientID =
tblPatientTreatment.PatientID
WHERE (((tblPatientTreatment.ProtocolStudyNumber)=IIf
([Forms]!
[frmNoOfPatientsInEachProtocolByProtocol/Ptnumber]!
[PatientType]=1,<> 'CE',"CE")) AND
((tblPatientTreatment.ProtocolID) Is Not Null) AND
((tblPatientDemographic.Gender)="F" Or
(tblPatientDemographic.Gender)="M"))
GROUP BY tblPatientTreatment.ProtocolID,
tblPatientTreatment.SubProtocolID,
tblPatientTreatment.ProtocolStudyNumber,
tblPatientDemographic.Gender,
tblPatientTreatment.Consultation
PIVOT tblPatientTreatment.Consultation In
("43,742","22,029","40,576","51,006","PP","CO","NEW");
**************************************
thanks again
Al
-----Original Message-----
SQL something like
SELECT FieldA, FIELDB, ProtocolStudyNumber
FROM YourTableName
WHERE (ProtocolStudyNumber = 'CE' and Forms!
[frmNoOfPatientsInEachProtocolByProtocol/Ptnumber]!
OR (ProtocolStudyNumber <> 'CE' and Forms! [frmNoOfPatientsInEachProtocolByProtocol/Ptnumber]!
[PatientType]=1)
Access query grid will probably create an ugly looking mess of this.
Can you copy and post the SQL of your query? Then perhaps someone can post the
exact text you need.
(Possibly unneeded instructions follow)
Open the query
Select View:Sql from the Menu
Select all the text
Copy it
Paste it into the message
I think I miswrote the expression the expression is:
IIf([Forms]!
[frmNoOfPatientsInEachProtocolByProtocol/Ptnumber]!
[PatientType]=1,<>'CE'),'CE') and it is placed under
[ProtocolStudyNumber] field which is from
tblPatientTreatment table. I wrote the expression as you
see it now but access automatically addedd
the "[tblPatientTreatment].[ProtocolStudyNumber]" as you
saw it in my original message. I am simpley trying to
accomplish the following:
If [PatientType] (Option group) = 1 then I want to see all
recoreds that are not equal to "CE" in the in the
[ProtocolStudyNumber] field ( this is the case that is
not working with me). Else, I want to see all records that
are equal to "CE" in the [ProtocolStudyNumber].
-----Original Message-----
The IIf structure is an if-then-else structure. You need
to nest it in order to do a second if: see below
IIf([Forms]!
[frmNoOfPatientsInEachProtocolByProtocol/Ptnumber]!
[PatientType]=1,IIf([tblPatientTreatment].
[ProtocolStudyNumber]<>'CE','CE','CE'))
-----Original Message-----
I put the following expression in the criteria of a
query:
IIf([Forms]!
[frmNoOfPatientsInEachProtocolByProtocol/Ptnumber]!
[PatientType]=1,([tblPatientTreatment].
[ProtocolStudyNumber]<>'CE'),'CE')
it only works in the case of 'CE' only i.e. (PatientType
=1) but it does not work when it is not CE (<> 'CE').
any help?
thanks
Al
.
.
.