我试图在我的 VBA 中创建一个函数,如果他们尝试插入的记录已经存在,但它返回类型不匹配。
EventCombo 是一个整数 MedalCombo 是字符串
Private Sub MyCombo_BeforeUpdate(Cancel As Integer)
If Not IsNull(DLookup("RacerID", "Medals", "RaceID = " + EventCombo.Value _
+ " AND Medal = '" + MedalCombo.Value + "'" )) Then
MsgBox "Record Exists"
End If.
End Sub
这样做(或应该做的)是确保没有其他人在同一场比赛中获得相同的奖牌。
我究竟做错了什么?