Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am having fun and games, trying to take the values entered through a
user form for a start date and end date and then using these dates in a query. Has any one ever tried this and how have you passed the values from the userform into the query ? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The SQL syntax will depend on the provider. This example is based on
Jet for Excel and assumes your dates are in textboxes named txtStartDate and txtEndDate respectively: Dim strSql As String Const DATE_FORMAT As String = "dd mmm yyyy" strSql = "SELECT Amount FROM [EarningsHistory$]" & _ " WHERE DateEffective BETWEEN " & _ " #" & Format(txtStartDate.Text, DATE_FORMAT) & "#" & _ " AND #" & Format(txtEndDate.Text, DATE_FORMAT) & "#" The resultant query would look like this: SELECT Amount FROM [EarningsHistory$] WHERE DateEffective BETWEEN #01 JAN 2001# AND #31 DEC 2001# -- (Steve Mildner) wrote in message . com... I am having fun and games, trying to take the values entered through a user form for a start date and end date and then using these dates in a query. Has any one ever tried this and how have you passed the values from the userform into the query ? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel connection to ODBC database | Excel Discussion (Misc queries) | |||
link ODBC connection to an Oracle database | Excel Discussion (Misc queries) | |||
ODBC connection failed. | Excel Discussion (Misc queries) | |||
ODBC connection by udl | Excel Programming | |||
ODBC System DSN Connection | Excel Programming |