I have a simple database table with a column called "Quantity". It stores the current quantity of various food items. In Excel, I want to allow the user to type in a number (say, 10) and add that number (10) to the current count in inventory in the database. The code I have is as follows:
Any tips?
Code:
dim rs as new recordset
strSql = "select * from Bakery"
strConnect = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source =" & ThisWorkbook.Path & "/Inventory.mdb;"
set rs = createobject("ADODB.Recordset")
rs.open strsql, strConnect, adOpenStatic, adLockPessimistic
rs.Find "[Item] = '" & Me.ComboBox2 & "'"
'I know the next line is wrong
rs("Quantity") = Current Quantity + ComboBox3.Value
rs.Update
rs.close
set rs = nothing
end sub
Comment