I have a command button in which I am trying to locate a duplicate entry. Here is the coding for it:
Dim s As String
Dim strField As String
If IsNull(Me![cmboBuyerID]) = True Then
MsgBox ("You need a buyer")
Exit Sub
End If
If IsNull(Me![cmboSellerID]) = True Then
MsgBox ("You need a seller")
Exit Sub
End If
s = "[SellerId]='" & Me![cmboSellerID] & "' AND "
s = s & "[BuyerId]='" & Me![cmboBuyerID] & "' AND "
s = s & "[TransactionDate]=#" & Me![transdate] & "# "
strField = DLookup("DealID", "salessheet", s)
If Len(strField) > 0 Then
MsgBox "That value already exists", vbOKCancel, "Duplicate Value"
Cancel = True
Exit Sub
Else
MsgBox "HA HA", vbOKCancel
Exit Sub
End If
My problem if the I continue to get an "Invalid Use of Null" error. I have tried to add several things and I am still getting it.
Dim s As String
Dim strField As String
If IsNull(Me![cmboBuyerID]) = True Then
MsgBox ("You need a buyer")
Exit Sub
End If
If IsNull(Me![cmboSellerID]) = True Then
MsgBox ("You need a seller")
Exit Sub
End If
s = "[SellerId]='" & Me![cmboSellerID] & "' AND "
s = s & "[BuyerId]='" & Me![cmboBuyerID] & "' AND "
s = s & "[TransactionDate]=#" & Me![transdate] & "# "
strField = DLookup("DealID", "salessheet", s)
If Len(strField) > 0 Then
MsgBox "That value already exists", vbOKCancel, "Duplicate Value"
Cancel = True
Exit Sub
Else
MsgBox "HA HA", vbOKCancel
Exit Sub
End If
My problem if the I continue to get an "Invalid Use of Null" error. I have tried to add several things and I am still getting it.