Hi guys
is there a simple way to update the value of a specific record in a table so that the new value is the old value +1?
let us say i have a table1 and i want to update the value of units where the Item column equals Cars
i can do this by:
Dim oldVal as Integer
Dim sqlString as String
oldVal= DLookup("Units", "Table1", "[Item]= Cars")
oldValue=oldValue+1
sqlString = "Update [Table1] Set [Units]= '" & oldVal & "' Where [Item]= Cars "
DoCmd.SetWarnings False
DoCmd.RunSQL sqlString
DoCmd.SetWarnings True
The whole thing feels however awckward, there has to be an easier way to do that ??
ANy suggestions?
is there a simple way to update the value of a specific record in a table so that the new value is the old value +1?
let us say i have a table1 and i want to update the value of units where the Item column equals Cars
i can do this by:
Dim oldVal as Integer
Dim sqlString as String
oldVal= DLookup("Units", "Table1", "[Item]= Cars")
oldValue=oldValue+1
sqlString = "Update [Table1] Set [Units]= '" & oldVal & "' Where [Item]= Cars "
DoCmd.SetWarnings False
DoCmd.RunSQL sqlString
DoCmd.SetWarnings True
The whole thing feels however awckward, there has to be an easier way to do that ??
ANy suggestions?