Adding, Subtrating, Replacing

JBurlison

Registered User.
Local time
Today, 17:52
Joined
Mar 14, 2008
Messages
172
Hello i have a Button that Updates quanity on another table the Form that this is on is its Subform.
Im having trouble setting my Currentvalue should i use another method besides DLookup sence i have the tables linked by Part Name? still kinda new to this HELP! what is wrong here?

Code:
Private Sub Command15_Click()

Dim HowMeny
Dim CurrentValue


HowMeny = Me.How_Meny_.Value
CurrentValue = DLookup("[Total Ammount]", "[Parts Inventory]", "[Part Name] = '" & Me.Part_Name & "'")

If Me.Adding_Or_Subtracting_ = "Adding" Then

    CurrentValue = HowMeny + CurrentValue
    Else
End If

If Me.Adding_Or_Subtracting_ = "Subtracting" Then

    CurrentValue = CurrentValue - HowMeny
    Else
End If

If Me.Adding_Or_Subtracting_ = "Balancing" Then

    CurrentValue = HowMeny
    Else
End If

DoCmd.GoToRecord , , acNewRec


End Sub
 
it sounds like this is stock/inventory control and you are trying to maintain a current stock count level, as you enter transactions

this isnt really the best way to manage stock levels - search this site for inventory/stock or something similar - theres loads of threads on it


having said that, you may well be looking up the currentvalue, but depending on the form(s) you are using are bound, you may not actually be saving/processing the currentvalue correctly
 

Users who are viewing this thread

Back
Top Bottom