G
Guest
I have a table. The records have a bunch of data, including a date.
I created a crosstab query to summarize statistical information for all records in the table.
I now want to create a form that displays the results of the crosstab query. The form has controls that are bound to the query fields. However, I want to limit the records used in the crosstab query to a specific date range selected by the user. On my form I have two calendar controls, one for the start date and one for the end date. I have a command button and when the button is clicked it should run the crosstab query but the query should only use records that are within the specified date range. How can I do this?
Here's the code I've written so far:
Option Explicit
Private StartDate As Date
Private EndDate As Date
Private Sub cmdTest_Click()
Dim strTest
'Get date values and put into variables
StartDate = calStartDate.Value
EndDate = calEndDate.Value
'Do some error handling once I get the query stuff figured out
'Test - is the date correct? It better be...
strTest = "Start Date: " & StartDate & vbCrLf & "End Date: " & EndDate
Call MsgBox(strTest)
'Run the crosstab query here, using dates to select specific records
'?????
End Sub
Thanks in advance.
Evan
I created a crosstab query to summarize statistical information for all records in the table.
I now want to create a form that displays the results of the crosstab query. The form has controls that are bound to the query fields. However, I want to limit the records used in the crosstab query to a specific date range selected by the user. On my form I have two calendar controls, one for the start date and one for the end date. I have a command button and when the button is clicked it should run the crosstab query but the query should only use records that are within the specified date range. How can I do this?
Here's the code I've written so far:
Option Explicit
Private StartDate As Date
Private EndDate As Date
Private Sub cmdTest_Click()
Dim strTest
'Get date values and put into variables
StartDate = calStartDate.Value
EndDate = calEndDate.Value
'Do some error handling once I get the query stuff figured out
'Test - is the date correct? It better be...
strTest = "Start Date: " & StartDate & vbCrLf & "End Date: " & EndDate
Call MsgBox(strTest)
'Run the crosstab query here, using dates to select specific records
'?????
End Sub
Thanks in advance.
Evan