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

Access 97 and SQL server pass through date issue 1

Status
Not open for further replies.

MyNeckHurts

Programmer
Apr 5, 2002
34
US
I need to be able to pull data from a sql database for month to date and last full months data. I'm having an issue with date time. Here's an example of the sql where clause:

Where (((dbo_RMS_Roll30DAY_SALES_EXCH_DLY.TXN_DT) Between (Select FetchStartDate From FetchDateTable) AND (Select FetchEndDate From FetchDateTable))

The FetchEndDate and FetchStartDate are true dates as in 01/01/2005 and 01/31/2005. But the dbo_RMS_Roll30DAY_SALES_EXCH_DLY.TXN_DT is a date time. When the query runs it is missing days from the first day of the month and the last day of the month (most likely due to the date time issue).

Does anyone have an idea of how I can pull month to date and last full month without this date time issue?

Thanks!
 
Simply have FetchStartDate = 01/01/2005 00:00:00
and FetchEndDate = 01/31/2005 23:59:59

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I don't know why I didn't even think of doing that but it did the trick, thanks a bunch!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top