Hello everyone,
I am using a Dcount expression to let a user know if they have already entered in a record on a certain date it will tell them and then cancel the action. My problem is that my Dcount expression only works part of the time. I have it checking through several columns at once which could be the problem but that is what i need it to do.
Also there are 9 text boxes on my form to enter in the information so i have this same code running for each text box so once you put in the information it checks to make sure it is not duplicating anything. Also I have tried running the code in both before and afterupdate.
Any help on this would be greatly appreciated :D
Thanks
I am using a Dcount expression to let a user know if they have already entered in a record on a certain date it will tell them and then cancel the action. My problem is that my Dcount expression only works part of the time. I have it checking through several columns at once which could be the problem but that is what i need it to do.
Also there are 9 text boxes on my form to enter in the information so i have this same code running for each text box so once you put in the information it checks to make sure it is not duplicating anything. Also I have tried running the code in both before and afterupdate.
Any help on this would be greatly appreciated :D
Thanks
Code:
If DCount("*", _
"[MainTable]", _
"(([Date]=#" & Format(Me.Text3, "mm/dd/YYYY") & "#) AND (" & _
"[Box1]=" & Chr(34) & Me.Text7 & Chr(34) & ") or (" & _
"[Box2]=" & Chr(34) & Me.Text7 & Chr(34) & ") or (" & _
"[Box3]=" & Chr(34) & Me.Text7 & Chr(34) & ") or (" & _
"[Box4]=" & Chr(34) & Me.Text7 & Chr(34) & ") or (" & _
"[Box5]=" & Chr(34) & Me.Text7 & Chr(34) & ") or (" & _
"[Box6]=" & Chr(34) & Me.Text7 & Chr(34) & ") or (" & _
"[Box7]=" & Chr(34) & Me.Text7 & Chr(34) & ") or (" & _
"[Box8]=" & Chr(34) & Me.Text7 & Chr(34) & ") or (" & _
"[Box9]=" & Chr(34) & Me.Text7 & Chr(34) & "))") > 0 Then
LResponse = MsgBox("A Record Of This Box On This Date Already Exists.", vbNo + vbQuestion, "Overwrite")
LResponse = vbNo
Cancel = True
End If
Comment