jeudi 9 février 2017

How to check if an item has already been selected on a subform?

Vote count: 0

I have the following vba code to check wether a product is already selected on a subform. And then alert the user.

Private Sub ProdId_Combo_BeforeUpdate(Cancel As Integer)
  Dim icount As Long
  icount = Nz(DCount("[ProdID]", "ProdRestockDetails", "[ProdID]=" & Me.ProdID & " AND RestockID=" & Me.RestockID, 0))
    If icount <> 0 Then
       MsgBox "this item has already been selected."
       Cancel = True
       Undo
    End If
End Sub

But it throws an error. Can someone help me set it correctly please?

asked 28 secs ago

Let's block ads! (Why?)



How to check if an item has already been selected on a subform?

Aucun commentaire:

Enregistrer un commentaire