Validate Quantity

johnzila

Registered User.
Local time
Today, 09:19
Joined
Jun 19, 2004
Messages
11
Hi can anyone help me...i am really desperate in help...

I got this database...
When i palce an Order...i specified my quantity...

i just wana check my Stock table whether the quantity i specified is avaible...
Pls take time to vet thorugh my database...

I really need help....
ignore some errors as i remove a few forms and report to suit the 100KB size
 

Attachments

Try pasting the following code in the Code Module of the form Order_Details Subform:
Code:
Private Sub quantity_AfterUpdate()
    Dim rst As Recordset
    Set rst = CurrentDb.OpenRecordset("SELECT Sum([quantity]) AS QTY FROM Stock WHERE item_number='" & Me.item_number & "';")
    If rst!qty < Me.quantity Then
        MsgBox "Insufficient Quantity"
        Me.quantity = rst!qty
    End If
    rst.Close
End Sub
 
Thx a million!!!!

:eek: OH GOD man !!!!
U save my live!!!!
i was really few days with tat assignment....

THX A MILLION BRO!!!!
 

Users who are viewing this thread

Back
Top Bottom