G
Guest
Thanks in advance.
I am running an update query ("qryDeactivateInventory") to update a checkbox
in table "tblInventory" to false from a form named "frmVehicleSale".
This is the code that runs the query from "frmVehicleSale" form.
'*** De-Activate Sold Inventory
DoCmd.OpenQuery "qryDeactivateInventory", acViewNormal, acEdit
This is the SQL code for "qryDeactivateInventory":
UPDATE tblInventory SET tblInventory.active = False
WHERE (((tblInventory.stockno)=[forms]![frmVehicleSale]![stockno]));
I would like to perform the same function but without using a separate query.
I tried the following, but it didn't update the correct record in table
"tblInventory". I can't get the association of the form data
("frmVehicleSale") to the "tblInventory" table right.
Private Sub save_sale_Click()
Dim rctSellInventory As DAO.Recordset
Set rctSellInventory = db.OpenRecordset("tblInventory", dbOpenTable)
rctSellInventory.Edit
rctSellInventory!active = False
rctSellInventory.Update
DoCmd.Close
rctSellInventory.Close
db.Close
End Sub
I am running an update query ("qryDeactivateInventory") to update a checkbox
in table "tblInventory" to false from a form named "frmVehicleSale".
This is the code that runs the query from "frmVehicleSale" form.
'*** De-Activate Sold Inventory
DoCmd.OpenQuery "qryDeactivateInventory", acViewNormal, acEdit
This is the SQL code for "qryDeactivateInventory":
UPDATE tblInventory SET tblInventory.active = False
WHERE (((tblInventory.stockno)=[forms]![frmVehicleSale]![stockno]));
I would like to perform the same function but without using a separate query.
I tried the following, but it didn't update the correct record in table
"tblInventory". I can't get the association of the form data
("frmVehicleSale") to the "tblInventory" table right.
Private Sub save_sale_Click()
Dim rctSellInventory As DAO.Recordset
Set rctSellInventory = db.OpenRecordset("tblInventory", dbOpenTable)
rctSellInventory.Edit
rctSellInventory!active = False
rctSellInventory.Update
DoCmd.Close
rctSellInventory.Close
db.Close
End Sub