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

Access Date Issues?

Status
Not open for further replies.
Hi Brian,
That's quite a hassle you're having. If you have Access then you probably have the Northwinds sample database. If you could find it and paste this in to a new query in SQL maybe it would give you some clues:

SELECT [Order Details].ProductID, Orders.OrderID, Orders.OrderDate
FROM Orders RIGHT JOIN [Order Details] ON Orders.OrderID = [Order Details].OrderID
WHERE (((Orders.OrderDate)>#1/1/1998#));

Although it's not patients and visits, its products and orders and seems to do what I asked it to. Check it out if you have a chance. :) Gord
ghubbell@total.net
 
I notice in your query you have coded "b.VisitDate > 12/31/1998". Wouldn't "12/31/1998" in that context be interpreted as two division operations, yielding a very small number (about .0001937)?

I don't know much about current ANSI standard SQL. My old ANSI SQL reference doesn't even include a date data type. Could it be that there isn't one? How does the visit date come to be stored in the database? Most DBMSs (Access for instance) encode a date as a floating point number giving the number of days since a particular base date, but the base date depends on the DBMS. Whatever DBMS is storing this date, you have to understand what its base date is, as well as the base date for the system you're writing SQL for. And you might have to convert between them in order to avoid comparing apples and oranges. Rick Sprague
 
Rick--

I was thinking along your lines too. The database I described on the ANSI thread is actually just a simple model of a database that I'm working on. The problem is I can't get SQL work on this model with 4 records in it! I don't know if Access let's you do the >< operations on a date/time field and that's why I to moved the conversation to this thread. As far as syntax goes, the SELECT statements they wrote on the ANSI board look good to me and I have done similar operations on other DBMS', but for whatever reason I can't get any of them to work on this model. I haven't tried ghubel's solution yet which looks more like what query generator gives you so I'll adapt that and give it a shot, but otherwise I'm stumped.
 
It works!

Everyone had a hand in the solution. The queries over on the ANSI thread just needed #'s around the date. Thanks to everyone who helped.

--B
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top