Hi Stephen,
Yes it should return earliest Effective date which is larger than the primary query's Effective date . If there is no data that meets this criteria, this should use Discharge date .
For Example : If person XXX admitted in ED at - 5/17/16 at 09:30 am (This is nothing but Effective date for location ED)
Then we move the person 5E at 5/18/16 at 3:30pm (Effective date for location 5E)
Then he discharged from 5E location at 5/19/16 7:30am (This is discharge date)
So This is how my results should be
For ED - Arrival Date 5/17/16 and Arrival time 9:30 am and DismissalDate 5/18/16 and DismissalTime 3:30pm (This is nothing but 5E location arrival time , But the problem is here query returning discharge date which is wrong )
For 5E- Arrival Date 5/18/16 and Arrival time 3:30 pm and DismissalDate 5/19/16 and DismissalTime 7:30am (This is nothing but Discharge date time )
For some of data it is working fine. but most of data it is returning Discharge date blindly..
Below is the full query , Can you please suggest as soon as possible ? 
**select **
VisitID, EventDateTime, EventSeqID, LocationID, RoomID, EffectiveDateTime
**into a_DSS.dbo.TempBedData **
from AdmVisits
where Code IN ('TRADM','EADMOB')
and (EffectiveDateTime > @FromDate and EffectiveDateTime < @ToDate)
**select **
--a.VisitID as RemoveLater,
c.UnitNumber as MRN,
**SUBSTRING(c.Name, 1, CHARINDEX(',', c.Name) - 1) AS LastName, **
**SUBSTRING(c.Name, CHARINDEX(',', c.Name)+1,30) AS FirstName, **
Convert(Varchar(20),c.BirthDateTime,101) as BirthDate, **
CONVERT(Varchar(20),isnull(c.AdmitDateTime,c.ServiceDateTime),101) as AdmitDate,
c.Account as EncounterID, **
a.LocationID as Unit,
a.RoomID as Room,
CONVERT(Varchar(20),a.EffectiveDateTime,101) as LocationArrivalDate,
CONVERT(Varchar(15),Cast(a.EffectiveDateTime as time), 100) as LocationArrivalTime,
isnull((select Top 1 CONVERT(Varchar(20),b.EffectiveDateTime,101) **
** from a_DSS.dbo.TempBedData b where b.VisitID = a.VisitID and b.EffectiveDateTime > a.EffectiveDateTime order by b.EffectiveDateTime),
** CONVERT(Varchar(20),c.DischargeDateTime,101)) as LocationDismissalDate,
isnull((select Top 1 CONVERT(Varchar(15),Cast(b.EffectiveDateTime as time), 100) **
** from a_DSS.dbo.TempBedFlow b where b.VisitID = a.VisitID and b.EffectiveDateTime > a.EffectiveDateTime order by b.EffectiveDateTime),
** CONVERT(Varchar(15),Cast(c.DischargeDateTime as time), 100)) as LocationDismissalTime
FROM AdmVisits a
**LEFT JOIN BarVT c ON a.VisitID = c.VisitID **
where a.Code IN ('TRADM','EADMOB')
and (c.DischargeDateTime > @FromDate and c .DischargeDateTime < @ToDate )
order by a.EffectiveDateTime
waiting for your reply//
Thank you so much on helping me on this..