Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / May 2006

Tip: Looking for answers? Try searching our database.

Query on Occupany

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gem_max - 14 May 2006 11:59 GMT
I wish to determine what beds are available on a user specified date. I can
query a specific date [Requested Date(dd/mm/yyyy)], however I can not get
anything more than results of the beds booked on that date, whereas I would
like that data PLUS results showing which beds were booked previously but are
still occupied on the user specified date. I'm quite the n00b to SQL, so
instead I have been entering combinations of <= and > etc with my
Expected_Discharge and Admission_Date fields (both date/time) and
unfortunately still havent found the results I know are there waiting. If you
need more info to help me just ask :)

Thanks!
John Spencer - 14 May 2006 14:53 GMT
WHERE [Requested Date(dd/mm/yyyy)] Between [Admission_Date] and [Expected_Discharge]

In the query grid
Field: OnDate: [Requested Date(dd/mm/yyyy)]
Criteria: Between [Admission_Date] and [Expected_Discharge]

More efficient would be
Field: Admission_Date
Criteria: Admission_Date <= [Requested Date(dd/mm/yyyy)]

Field: Expected_Discharge
Criteria: >= [Requested Date(dd/mm/yyyy)]

SQL where clause

WHERE Admission_Date <=[Requested Date(dd/mm/yyyy)]
AND Expected_Discharge >= [Requested Date(dd/mm/yyyy)]

This makes the assumption that you always have a value in BOTH fields.  If
Expected_Discharge can be null then the criteria will have to be modified.

> I wish to determine what beds are available on a user specified date. I can
> query a specific date [Requested Date(dd/mm/yyyy)], however I can not get
[quoted text clipped - 7 lines]
>
> Thanks!
gem_max - 14 May 2006 15:57 GMT
Thanks so much!!! I tried the grid criteria first, both cases produced blank
results, so I opted for the SQL way and IT WORKED PERFECTLY :)

I knew it'd be something simple and easily managed. :P

Thanks again :)

> WHERE [Requested Date(dd/mm/yyyy)] Between [Admission_Date] and [Expected_Discharge]
>
[quoted text clipped - 16 lines]
> This makes the assumption that you always have a value in BOTH fields.  If
> Expected_Discharge can be null then the criteria will have to be modified.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.