Hi sir ,
I have a mainform and a subform , if I entry created product Id No in subform [Productid] text control other details are will appear automatically and if I enter non created any digits (product no ) msg will show as “incorrect no” and if blank [productid] text control cursor will not go to next step ( for this I amusing macro- [productid] is null- cancel event) this all working very well ,but I cannot be find correct code for if I enter except digits (a-z,!@#$%..etc) also should show cancel event function or “incorrect no” msg
Please help me!!!!!!!!
Private Sub ProductID_AfterUpdate()
On Error GoTo Err_ProductID_AfterUpdate
Dim strfilter As String
strfilter = "productID=" & Me!ProductID
Me!UnitPrice = DLookup("UnitPrice", "Products", strfilter)
Me.ProductID.SetFocus
Cancel = Not IsNumeric(ProductID)
Exit_ProductID_Afterupdate:
Exit Sub
Err_ProductID_AfterUpdate:
If Not IsNumeric(ProductID) Then
Undo
If Me.ProductID.Value <> DLookup("ProductId", "Products") Then
MsgBox "incorrect no", vbCritical, "system"
SendKeys "{home}"
Undo
End If
End Sub
Thanks
alex