Hi, I am trying to filter a form from a dialog box. In using DateAdd, I could not get vba to understand that I have an SQL statement and the DataAdd Function i.e. DateAdd("d",30,[RADue]). It got confused with the quotes. So I tried to create a variable called 'DateCheck'. I then equated it with the above DateAdd Function. However, now it doesn't recognize my field (from the form I have opened). Can anyone help?
Private Sub Ok_Click()
Me.Visible = False
Dim strWhere As String
Dim DateCheck As Date
DateCheck = DateAdd("d", 30, [RADue])
strWhere = "1=1 "
strWhere = strWhere & " AND [PEID]=" & Me![PE_ID] & _
" AND [BUID]=" & Me![BU_ID]
Select Case Me.RptType
Case 1
Select Case Me.OvrDue
Case 1
StrWhere = strWhere & " AND DateCheck => Date()" & _
" AND [RADue]< Date() " & _
" AND [RAComp]Is Null
Private Sub Ok_Click()
Me.Visible = False
Dim strWhere As String
Dim DateCheck As Date
DateCheck = DateAdd("d", 30, [RADue])
strWhere = "1=1 "
strWhere = strWhere & " AND [PEID]=" & Me![PE_ID] & _
" AND [BUID]=" & Me![BU_ID]
Select Case Me.RptType
Case 1
Select Case Me.OvrDue
Case 1
StrWhere = strWhere & " AND DateCheck => Date()" & _
" AND [RADue]< Date() " & _
" AND [RAComp]Is Null