crisis2007
Technical User
I have 2 fields on a form ("StartDate" and "Watch" and a command button that runs code to check in a query so I can prevent a duplicate entry. It does not always work and I can not figure it out. It will work with some dates and some it will not work. Here is the code behind the command button:
Private Sub Command26_Click()
Dim stDocName As String
Dim stLinkCriteria As String
Dim numActivity As Integer
numActivity = 0
numActivity = DCount("*", "Q_ActivityDupCheck3")
If numActivity > 0 Then
MsgBox "Activity Report for date " & Me.StartDate & " Watch " & Me.Watch & " already exists."
Form![Watch] = Null
End If
End Sub
My Query is as follows:
SELECT T_Activity.ActivityDate, T_Activity.Watch
FROM T_Activity
WHERE (((T_Activity.ActivityDate)=[Forms]![F_NewDateActivityAdd]![StartDate]) AND ((T_Activity.Watch)=[Forms]![F_NewDateActivityAdd]![Watch]))
ORDER BY T_Activity.ActivityDate DESC , T_Activity.Watch;
I appreciate any help.
Private Sub Command26_Click()
Dim stDocName As String
Dim stLinkCriteria As String
Dim numActivity As Integer
numActivity = 0
numActivity = DCount("*", "Q_ActivityDupCheck3")
If numActivity > 0 Then
MsgBox "Activity Report for date " & Me.StartDate & " Watch " & Me.Watch & " already exists."
Form![Watch] = Null
End If
End Sub
My Query is as follows:
SELECT T_Activity.ActivityDate, T_Activity.Watch
FROM T_Activity
WHERE (((T_Activity.ActivityDate)=[Forms]![F_NewDateActivityAdd]![StartDate]) AND ((T_Activity.Watch)=[Forms]![F_NewDateActivityAdd]![Watch]))
ORDER BY T_Activity.ActivityDate DESC , T_Activity.Watch;
I appreciate any help.