LarryDavidow
Technical User
I have a table that has two fields combined to form a Key field. I want to use the Dcount function to customize a msgbox when the user enters a value that already exists for that record in the subform. However, the Dcount function needs to hold true for both fields, not one OR the other...
Here is what I have so far...
Private Sub Combo10_AfterUpdate()
Dim intCt As Integer
intCt = DCount("[ModCode]", "CastingDetail", "[ModCode] = '" & Me.Modcode & "'"
If intCt <> 0 Then
MsgBox "You have already selected " & Me.Combo10.Column(1) & " for this casting"
Me.Combo10 = ""
Exit Sub
End If
End Sub
I need something like this, however, it's not working...
Private Sub Combo10_AfterUpdate()
Dim intCt As Integer
intCt = DCount("[ModCode]", "CastingDetail", "[ModCode] = '" & Me.Modcode & "'" And DCount("[CastingDetailCode]", "CastingDetail", "[CastingDetailCode] = " & Me.CastingDetailCode & ""
If intCt <> 0 Then
MsgBox "You have already selected " & Me.Combo10.Column(1) & " for this casting"
Me.Combo10 = ""
Exit Sub
End If
End Sub
I hope this is enough info...
Larry
Here is what I have so far...
Private Sub Combo10_AfterUpdate()
Dim intCt As Integer
intCt = DCount("[ModCode]", "CastingDetail", "[ModCode] = '" & Me.Modcode & "'"
If intCt <> 0 Then
MsgBox "You have already selected " & Me.Combo10.Column(1) & " for this casting"
Me.Combo10 = ""
Exit Sub
End If
End Sub
I need something like this, however, it's not working...
Private Sub Combo10_AfterUpdate()
Dim intCt As Integer
intCt = DCount("[ModCode]", "CastingDetail", "[ModCode] = '" & Me.Modcode & "'" And DCount("[CastingDetailCode]", "CastingDetail", "[CastingDetailCode] = " & Me.CastingDetailCode & ""
If intCt <> 0 Then
MsgBox "You have already selected " & Me.Combo10.Column(1) & " for this casting"
Me.Combo10 = ""
Exit Sub
End If
End Sub
I hope this is enough info...
Larry