AHA! YOUR where clause appears to say to get records where
LastModifiedBy is like tmc-Daneille* AND is between a specified date range
AND in addition to that return ALL records where the lastModifiedby is
like tmc-Ginger with NO date range specified.
In query design view you would need to repeat the date criteria on the
second line of criteria where you specify tmc-ginger*
The SQL should look something like this. Access will reformat that into
a bit more complicated version of the where clause.
SELECT dbo_VisitTransactions.LastModifiedBy,
dbo_VisitTransactions.LastModified, dbo_PatientVisit.TicketNumber,
dbo_VisitTransactions.Payments, dbo_VisitTransactions.Adjustments
FROM [Date Range], dbo_VisitTransactions INNER JOIN dbo_PatientVisit ON
dbo_VisitTransactions.PatientVisitid = dbo_PatientVisit.PatientVisitId
WHERE (dbo_VisitTransactions.LastModifiedBy Like "tmc-danielle*" OR
AND dbo_VisitTransactions.LastModifiedBy Like "tmc-ginger*")
AND dbo_VisitTransactions.LastModified Between CDate([from date]) And
CDate([to date])
ORDER BY dbo_VisitTransactions.LastModifiedBy;
'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
Here it is in SQL view.. Thanks so much for your help guys! YOU ROCK!!
SELECT dbo_VisitTransactions.LastModifiedBy,
dbo_VisitTransactions.LastModified, dbo_PatientVisit.TicketNumber,
dbo_VisitTransactions.Payments, dbo_VisitTransactions.Adjustments
FROM [Date Range], dbo_VisitTransactions INNER JOIN dbo_PatientVisit ON
dbo_VisitTransactions.PatientVisitid = dbo_PatientVisit.PatientVisitId
WHERE (((dbo_VisitTransactions.LastModifiedBy) Like "tmc-danielle*") AND
((dbo_VisitTransactions.LastModified) Between CDate([from date]) And
CDate([to date]))) OR (((dbo_VisitTransactions.LastModifiedBy) Like
"tmc-ginger*"))
ORDER BY dbo_VisitTransactions.LastModifiedBy;
John W. Vinson said:
Startig Point: I am pulling data using ODBC.. I cannot modify the Tables in
any way.
The Date field is in this format: 1/15/2009 12:30:00 AM
I have in the Criteria section of my query the following: BETWEEN [date
from] AND [date to]
The [date from] and [date to] are fields that are coming from a table that I
have made that CAN be modified and contain the dates that I am trying to
pull.
My Problem is that even though in MY table, the date format is the same as
the other Table, it does not pull data that are within these boundaries.. it
pulls ALL dates, like there isn't criteria at all.
PLS HELP!!
MarieG
The Format of your local field is irrelevant: dates aren't stored as strings
but as numbers, a count of days and fractions of a day (times) since an
arbitrary start point. What is the datatype of the ODBC-linked date field -
Date/Time or Text? Could you open your query in SQL view and post the SQL text
here?