chineloogbonna
Registered User.
- Local time
- Today, 13:05
- Joined
- Jul 30, 2018
- Messages
- 65
Good Afternoon,
Hoping someone can assist with this simple code. I cannot get the If then statement to work.
I have a table called "NIGO_Data" on the table there is a field called "SubDate" which holds the date of the record.
I want my if then statement to search the NIGO_Data Table and only count the recodes if the SubDate field matches Todays Date. So far I have this, but its not working. Please help!
Hoping someone can assist with this simple code. I cannot get the If then statement to work.
I have a table called "NIGO_Data" on the table there is a field called "SubDate" which holds the date of the record.
I want my if then statement to search the NIGO_Data Table and only count the recodes if the SubDate field matches Todays Date. So far I have this, but its not working. Please help!
Private Sub form_current()
On Error Resume Next
Dim CurrDate As Date
If (CDate(Forms!NIGO_Data!SubDate) <> CurrDate) Then
Exit Sub
Else
Me.txtCompleted = DCount("1", "NIGO_Data", "WorkType='Completed'")
Me.txtHandled = DCount("1", "NIGO_Data", "WorkType_fld='handled'")
Me.txtNoAction = DCount("1", "NIGO_Data", "WorkType_fld='NoAction'")
Me.txtWIP = DCount("1", "NIGO_Data", "WorkType_fld='WIP'")
Me.txtSuspend = DCount("1", "NIGO_Data", "WorkType_fld='Suspended/Serv Case'")
Me.txtFalseNIGO = DCount("1", "NIGO_Data", "WorkType_fld='FalseNIGO'")
Me.txtResort = DCount("1", "NIGO_Data", "WorkType_fld='Resort'")
End If
End Sub
Thank you!On Error Resume Next
Dim CurrDate As Date
If (CDate(Forms!NIGO_Data!SubDate) <> CurrDate) Then
Exit Sub
Else
Me.txtCompleted = DCount("1", "NIGO_Data", "WorkType='Completed'")
Me.txtHandled = DCount("1", "NIGO_Data", "WorkType_fld='handled'")
Me.txtNoAction = DCount("1", "NIGO_Data", "WorkType_fld='NoAction'")
Me.txtWIP = DCount("1", "NIGO_Data", "WorkType_fld='WIP'")
Me.txtSuspend = DCount("1", "NIGO_Data", "WorkType_fld='Suspended/Serv Case'")
Me.txtFalseNIGO = DCount("1", "NIGO_Data", "WorkType_fld='FalseNIGO'")
Me.txtResort = DCount("1", "NIGO_Data", "WorkType_fld='Resort'")
End If
End Sub