Upadate continue form problem

Kallu

Registered User.
Local time
Today, 10:02
Joined
Nov 4, 2011
Messages
18
Hi there.
I have inventory database. On continuous form, I filter multiple data, that data must updated on save or close, on tblInvenory.
I have code to update that data, but not updating all filtered data (rows) on form, updating only first row. (code are designed to update only numbers).
That code work great if I put, on before or after update, but I want that code to put on save or on close, to update data, If I want.
I attached sample database.
 

Attachments

Please give an explanation of what your database does.
 
This is inventory database. When I sell multiple goods, I want to update on tblInventory, when I save.
 
Uncle Grizmo, to apply those principles in my database, I have to change the whole structure of my database. How would that be, thank you for your efforts. My database works very good except the problem that I have presented in this forum. So not updating all ranges when I save or close the form. If I put VBA on after or before update, VBA code updates the data very well.
This is the vba code.

Dim sSQL, stringSQL As String
Dim rst As dao.Recordset

sSQL = "SELECT BarCode, [Emri] FROM tblInventory WHERE BarCode='" & Me.ID & "'"
Set rst = CurrentDb.OpenRecordset(sSQL)
If rst.EOF Then
MsgBox "Test"
Else
stringSQL = "UPDATE tblInventory SET [SasiaAktuale]=[SasiaAktuale]-" & Me.Sasia & ", [SasiaShitjes]=[SasiaShitjes]+" & Me.Sasia & " WHERE BarCode='" & Me.ID & "'"
DoCmd.SetWarnings False
DoCmd.RunSQL (stringSQL)
DoCmd.SetWarnings True
End If
rst.Close

I am new on vba code, but I think the problem is on continue form.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom