harleyskater
IT Manager
- Local time
- Today, 15:57
- Joined
- Oct 29, 2007
- Messages
- 95
I am trying to use Dcount to check to see if a Purchase Order Number has been used before.
I have 249 Purchase Orders in the DB and DCount returns 249!
I have played with the code for about an hour now and I have made queries as the domain and tables as the domain. I do not know what I am doing wrong. I have put a breakpoint in that code like 100 times! !!!!
Code:
Private Sub po_num_AfterUpdate()
Dim LTotal As Long
LTotal = DCount("po_id", "dbo_purchase_orders", po_num = Me.po_num)
If LTotal >= 2 Then
MsgBox "This PO# may already exist!", _
vbExclamation, "Possible Duplicate PO #"
End If
End Sub
I have 249 Purchase Orders in the DB and DCount returns 249!
I have played with the code for about an hour now and I have made queries as the domain and tables as the domain. I do not know what I am doing wrong. I have put a breakpoint in that code like 100 times! !!!!