how to use on dirty function in access
I use this 2 function...
I have 2 textbox for user key in..which is QtyReq and QtyIssued
QtyReq is for user to request how many item they want...that's didn't involve any calculation...and for QtyIssued that involve calculation. For example the main stock is 10...then user will put QtyReq 20 and QtyIssued to 10....then user will save it...and the main stock will auto deduct after user put 10 in Qty Issued...Now the stock become 0...Then the problem comes..when user want to update back without seeing the stock have or not...they open back the form that list as pending...which is QtyReq = 20 QtyIssued=10 and still got Balance=10....So user will open and change the QtyIssued as 20....that goes to the below coding...
Expand|Select|Wrap|Line Numbers
- QtyIssued_OnDirty()
- Dim user As Integer
- user = Nz(Dlookup("Stock","tableName","ItemCode='" me.ComboBox "'"))
- If Me.QtyIssued.Value Then
- DoCmd.OpenQuery "try1", acEdit''Stock+QtyIssued
- ElseIf user < QtyIssued Then
- MsgBox "Out Of Stock"
- DoCmd.Close
- EndIf