View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
jimmy jimmy is offline
external usenet poster
 
Posts: 59
Default Macro Creating Variable and using variable in a SQL statement

Created a Variable where someone enters a date into a inputbox

eg. StartDate = InputBox("Enter Start Date?", "Report")

Then i used this variable in the SQL statement by saying

date=Startdate in the where clause in the VB script.

Instead of using the variable it tried to put "startdate" in the field and
filter by "startdate"

How do i make the the macro use the variable in the SQL statement.

Also should i be changing the date in a date format for the variable in the
inputbox statement. Because it is currently under no format. How can i change
this format.

Thanks If anyone can help