Hello Tek-Tips and thank you again for taking the time to read my question. Is there a way to declare a variable in a SQL Select statement which will allow me to assign through VB6. I am generating a SQL statement which uses 4 dates as parameters. However these 4 dates are needed several times in the SQL statement. Instead of using a question mark for each one of them, can I declare a variable in the Select statement, assign this variable, and use it in the SQL code?
For example:
Declare @Date1 DATE
Declare @Date2 Date
SELECT Revenue FROM MyTable WHERE Date BETWEEN @Date1 AND @Date2
The SQL statement is simplified for this question. I want to be able to assign @Date1 and @Date2 through my code. Does Access 2002 allow for this?
Any suggestions are greatly appreciated.
Tom (maxflitom)
For example:
Declare @Date1 DATE
Declare @Date2 Date
SELECT Revenue FROM MyTable WHERE Date BETWEEN @Date1 AND @Date2
The SQL statement is simplified for this question. I want to be able to assign @Date1 and @Date2 through my code. Does Access 2002 allow for this?
Any suggestions are greatly appreciated.
Tom (maxflitom)