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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need some help again ;)

Status
Not open for further replies.

savok

Technical User
Jan 11, 2001
303
AT
In the table I have HospitalA and HospitalB and HospitalC.

When the user Selects a Hospital in VB he gets a report on it. Now what I need to do is make it so when the user Selects Hospital A or B, he will get a combined report on them.

This is what I had in the select statement before when the hospitals were individual

{pretest2.FacilityName}={?Facility} and {pretest2.Date}
in {?StartDate} to {?EndDate}

This is what I came up with when I needed to combine reports

if {?Facility} = "Harlem Hospital" or "Lincoln Hospital" then

{pretest2.FacilityName} = "Harlem Hospital" and "Lincoln Hospital" and {pretest2.Date}
in {?StartDate} to {?EndDate}

else

{pretest2.FacilityName}={?Facility}
and{pretest2.Date}
in{?StartDate}
to{?EndDate}

What I am hoping this will do is select the data for both hospitals. But for some reason it doesnt like the "or" in the beginning and says a boolean is required there.

Any suggestions? Or perhaps there is an easier way to select data from both hospitals
 
savok: Suggest you try the following:

if {?Facility} in ["Harlem Hospital","Lincoln Hospital"] then
{pretest2.FacilityName} in {?Facility}
and{pretest2.Date}in{?StartDate}to {?EndDate}
else
{pretest2.FacilityName}={?Facility}
and{pretest2.Date}in{?StartDate}to {?EndDate}

This has the effect of checking for either Harlem or Lincoln or both in the first case and for another name in the second David C. Monks
david.monks@chase-international.com
Accredited Seagate Enterprise Partner
 
thanks dmc but this still only selects data from the first hospital only not both?

Can anyone else help plz?

How can i write a select statement for the following, if Hospital = Harlem or Lincoln then select data where hospital is lincoln and harlem

 
i figured it out ;) the correct code was

if {?Facility} in ["Harlem Hospital","Lincoln Hospital"] then
{pretest2.FacilityName} in ["Harlem Hospital","Lincoln Hospital"]
and{pretest2.Date}in{?StartDate}to {?EndDate}
else
{pretest2.FacilityName}={?Facility}
and{pretest2.Date}in{?StartDate}to {?EndDate}


thanks a lot mcd!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top