ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   remote query & date range? (https://www.excelbanter.com/excel-programming/355319-remote-query-date-range.html)

Linn Kubler

remote query & date range?
 
Hi,

I'm using Excel 2003 to query a SQL 2000 database. The table I'm querying
has a date field, ship_date, and I'd like to be able to have the user of my
query specify ship dates before a selected date.

Here's what I've tried:
I have a simple form with a text field and if the user enters a date in the
text field I convert it to text with the format() function and save it in a
public variable. Then I concatonate that to my SQL query string like this:

strSQL = strSQL & "ship_date < '" & txtShipDate & "') "

(the right paren. is closing the where clause)

This works in that it doesn't give me any syntax errors but it doesn't work
in that it returns no records. I do get the field headers though. Any
ideas what I'm doing wrong here? Is there a more elegant solution? This
format works fine in the SQL Query Analyzer.

Thanks in advance,
Linn




All times are GMT +1. The time now is 02:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com