Hello I am trying to add various values based on Select Case to the value of field. The problem I face is that each time when I get different Case in select statement, the value of the field rather changing adds the value on top. :banghead:
Code:
Private Sub ProductID_AfterUpdate()
Dim qflPrice As Variant
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim sqlQry As String
Dim instID As Integer
instID = Me.Form!ProductID.Value
sqlQry = "SELECT Products.Price FROM Products WHERE Products.ProductID = " & instID & ""
Set db = CurrentDb
Set rs = db.OpenRecordset(sqlQry)
Me.flPrice.Value = rs!Price
End Sub
Private Sub ExtrasID_Change()
Dim extrID As Integer
Dim addNum As Integer
Static floorPrice As Integer
Static sumPrice As Integer
extrID = Me.ExtrasID.Value
floorPrice = Me.flPrice.Value
Select Case extrID
Case Is = 1
addNum = 5
sumPrice = floorPrice + addNum
Case Is = 2
addNum = 10
sumPrice = floorPrice + addNum
Case Is = 3
addNum = 15
sumPrice = floorPrice + addNum
End Select
Me.flPrice.Value = sumPrice
End Sub