[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

VBA Syntax Access 2007

Posted on 2011-05-11
3
Medium Priority
?
295 Views
Last Modified: 2012-05-11
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
0
Comment
Question by:HKFuey
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
Runrigger earned 2000 total points
ID: 35736106

'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
 

Author Closing Comment

by:HKFuey
ID: 35736148
Works perfectly, thanks!
0
 
LVL 11

Expert Comment

by:Runrigger
ID: 35736202
happy to help
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question