Access2000_JS1
Registered User.
- Local time
- Yesterday, 20:53
- Joined
- Dec 10, 2005
- Messages
- 24
HI, I have a table called cust_order, with fields: orderNo, product, ...
I have a form which updates these values.
On the 'enter' event of a button to 'update changes' I collect the stored values cust_order and compare these old values with the new values. I do it using the dlookup command like this;
Private Sub UpCust_OrderDetBut_Enter()
Dim old_product as string
old_product = DLookup("product", "cust_order", "orderNo = '" & Forms![update_order].orderNo + "'")
Dim old_product as variant
old_qty = DLookup("qty", "cust_order", "orderNo = '" & Forms![update_order].orderNo + "'")
' THERE ARE OTHER FIELDS
'I then compare these values with the ones in the form. Where they are different I write them along with info into another table to keep control of the changes.
End Sub
I would rather return all the fields in a select query but I do not know how to get the selected data into local variables. Assuming I want the two fields above, can someone show me how to achieve it through a query - something like:
docmd.runsql("select product into " &old_product + ", qty into " &old_qty +" from cust_order where orderNo = " & forms![update_order].orderNo )
Thanks John.
I have a form which updates these values.
On the 'enter' event of a button to 'update changes' I collect the stored values cust_order and compare these old values with the new values. I do it using the dlookup command like this;
Private Sub UpCust_OrderDetBut_Enter()
Dim old_product as string
old_product = DLookup("product", "cust_order", "orderNo = '" & Forms![update_order].orderNo + "'")
Dim old_product as variant
old_qty = DLookup("qty", "cust_order", "orderNo = '" & Forms![update_order].orderNo + "'")
' THERE ARE OTHER FIELDS
'I then compare these values with the ones in the form. Where they are different I write them along with info into another table to keep control of the changes.
End Sub
I would rather return all the fields in a select query but I do not know how to get the selected data into local variables. Assuming I want the two fields above, can someone show me how to achieve it through a query - something like:
docmd.runsql("select product into " &old_product + ", qty into " &old_qty +" from cust_order where orderNo = " & forms![update_order].orderNo )
Thanks John.