I am making a rather simple inventory tracking database. And I want to retrieve the record by ID, and add or remove the specified number to the amount. If it doesn’t exist I want to add it. Is it even possible to do this without binding to a table?
Share
Sounds like you have a candidate
IDvalue. Maybe it’s contained in a numeric variable namedMyID. And you have another numeric value,MyAmtChange, which is to be added to the value in a field namedamountin your table for the row where theIDfield value matchesMyID.A complication is there may be no row in your table whose
IDvalue matchesMyID. In that case, you need to add a row for it.If that’s correct,
INSERTa row forMyIDwhen one doesn’t exist. Then you can simplyUPDATEtheamountin the row which matchesMyID.If this guess is reasonably close, add an error handler block to that code to deal with any issues surfaced by
dbFailOnError… or any other errors.