Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Just read the original post more carefully, "yyyymm" format is what you want.
"Joshua Campbell" wrote: Thanks for the great reply. But, I guess I should have been a bit more clear as to where I was running into problems. When I put in the parameters, I always get an error. It is probably how I am doing it. See the example of the criteria for invdate below: Between '20050315' And [DateRange] & '31' I am trying to concatenate the returned value from DateRange and 31. How would I do this? Thanks. Joshua "K Dales" wrote in message ... First, set up cells to contain the dates that will be selected (hide them if desired). User input can be either directly on the worksheet, some InputBoxes, or a UserForm - just store/copy the results in the cells you set aside. Now, go to data menu, Get External Data, New Database Query. It should prompt you for the data source and I assume/hope your database will be one listed there. Choose the database driver, the file path (if needed) and the userID/password (if needed) to connect to the database. MSQuery will then start and you can set up the query in there, either graphically a la Access or type in the SQL directly - see MSQuery help if you need it. For your date range, use parameters (which are specified by using [] in the criteria grid; e.g. under SALESDATE you would put the following: Between [Date1] and [Date2]). When done return the data to Excel (via File menu or toolbar). It will prompt for Date1 and Date2; for now you can put anything in there. When you get back to Excel the data will appear in a list. Right-click on the list and choose Properties, then Parameters. You will see your Date1 and Date2 parameters - set them to "Get the value from the following cell:" and point them to the cells you designated on your sheet for the date values. Now you just need code to prompt the user for the new dates and refresh the query (which would be something like this: Sheets("Sheet1").Querytables(1).Refresh) This is a very brief outline, but hope it helps. Look in Excel help or MSDN library for more info if needed. "Joshua Campbell" wrote: I need to have Excel run a database querry, prompting the user for information. The SQL that would be used is something a lot like this: SELECT * FROM table18 WHERE (salesdate BETWEEN N'20050315' AND N'20050331') I need to prompt the user for the year and month, preferrably with one prompt, asking for the data in YYYYMM format, and then append the day number to what is entered. How would I accomplish this? Thank you. Joshua |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Microsoft Querry | Excel Worksheet Functions | |||
querry | Excel Discussion (Misc queries) | |||
Use two different value to run a querry | Excel Discussion (Misc queries) | |||
Querry Range and Add | Excel Programming | |||
Web Querry question | Excel Discussion (Misc queries) |