View Full Version : Solved: Minus A Value From A Record Using VBA
Hi Everyone
Well basically I have a form, and when a calcution is performed, (using VBA) I want a value e.g. 1 to be minused from a particular field within a record (this record will always be the same) and save that deducation permenantely within the table.
Help appreciated
XLGibbs
12-08-2007, 08:39 AM
When your form calculation executes, have it run and UPDATE statement..
without any more information..hard to give a clean anwer..
Update [Table]
Set [Column] = FormCalculationREsult - 1
Yeah that sounds like correct, except could I have a WHERE Cause which says WHERE ID = 2 for example? Sorry im quite new to VBA.
Also how would I write this in using VBA?
Thanks for your help
Ok I managed to figure it out, however I am getting an error with the query saying:
"Run Time Error '3061': Too few paramters. Expected 1.
Below is the query
CurrentDb.Execute "UPDATE AccommodationInformation SET AccommodationInformation.NumberOfRooms = AccommodationInformation.NumberOfRooms - StoreRoomQuantity WHERE AccommodationInformation.AccommodationInfoID = 1"
EDIT: Got everything working, and just used Exit Sub to ensure the input box isnt repeated :)
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.