Hi Guys
I have a button that opens a small form where the user can choose the dates between, then they click a button on that from which opens a form with a chart/graph relating to TblCustomerDetails.
Everything works fine but it doesn't filter or change the chart. This is the code I'm using can anyone tell me where I'm going wrong.
Many thanks.
I have a button that opens a small form where the user can choose the dates between, then they click a button on that from which opens a form with a chart/graph relating to TblCustomerDetails.
Everything works fine but it doesn't filter or change the chart. This is the code I'm using can anyone tell me where I'm going wrong.
Many thanks.
:banghead::banghead::banghead:Dim strForm As String
Dim strDateField As String
Dim strWhere As String
Dim lngView As Long
Const strcJetDate = "\#mm\/dd\/yyyy\#"
strForm = "Sales Form"
strDateField = "[DateSold]"
lngView = acNormal
If IsDate(Me.txtFROM) Then
strWhere = "(" & strDateField & " >= " & Format(Me.txtFROM, strcJetDate) & ")"
End If
If IsDate(Me.txtTO) Then
If strWhere <> vbNullString Then
strWhere = strWhere & " AND "
End If
strWhere = strWhere & "(" & strDateField & " < " & Format(Me.txtTO + 1, strcJetDate) & ")"
End If
Debug.Print strForm
DoCmd.OpenForm strForm, lngView, , strWhere
DoCmd.Close acForm, "FrmDateFilter", acSaveNo