Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Import database query that has a date range jonallen51 Excel Discussion (Misc queries) 0 June 10th 08 04:23 PM
How do I enter a date range ie -7 from current date in MS QUERY notsmartenough Excel Discussion (Misc queries) 1 November 11th 05 10:17 PM
HOW DO I CHANGE QUERY DATA TO A DATE RANGE? GRABrendan Excel Worksheet Functions 4 September 27th 05 04:43 AM
Remote data query stopped working Mark Scholes Excel Programming 0 February 24th 05 08:47 AM
remote data query and sum not working Sara Excel Worksheet Functions 0 November 4th 04 02:17 AM


All times are GMT +1. The time now is 02:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"