VBA Syntax Access 2007

I have a form that allows users to change data, I log the change with this code: -

 
'Audit qtys
            Sql = "INSERT INTO ChangeAudit ( OrderNo, OrderLine, Barcode, PreQty, ProgType, [DateTime] ) "
            Sql = Sql & "SELECT OrderDetail.OrderNo, OrderDetail.OrderLine, OrderDetail.Barcode, OrderDetail.QtyOrdered, 'OrderOut' AS Ord, Now() AS DTime "
            Sql = Sql & "FROM OrderDetail "
            Sql = Sql & "WHERE OrderDetail.OrderNo = " & CInt(Me![CboOrder]) & "  AND OrderDetail.OrderLine=" & CInt(Me![CboSelectLine]) & ""
            Dbs.Execute (Sql)

Open in new window


The change quantity is on the form as me!Qty, how do I add this to my audit table (ChangeQty field already exists)
Thanks
HKFueyAsked:
Who is Participating?
 
RunriggerConnect With a Mentor Commented:

'Audit qtys
            Sql = "INSERT INTO ChangeAudit ( OrderNo, OrderLine, Barcode, PreQty, ProgType, [DateTime],ChangeQty ) "
            Sql = Sql & "SELECT OrderDetail.OrderNo, OrderDetail.OrderLine, OrderDetail.Barcode, OrderDetail.QtyOrdered, 'OrderOut' AS Ord, Now() AS DTime," & Me!Qty & " "
            Sql = Sql & "FROM OrderDetail "
            Sql = Sql & "WHERE OrderDetail.OrderNo = " & CInt(Me![CboOrder]) & "  AND OrderDetail.OrderLine=" & CInt(Me![CboSelectLine]) & ""
            Dbs.Execute (Sql)

Open in new window

0
 
HKFueyAuthor Commented:
Works perfectly, thanks!
0
 
RunriggerCommented:
happy to help
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.