Click here to Skip to main content
15,888,014 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
During the current instantiatin of the below code, it does not save the reocrd, then asks to save the record in a dialog box during the next instantiation. Cannot see anything in the code to make it doe this. can someone help?
VB
Private Sub Taken_AfterUpdate()
    Dim db As Database
    Dim rst As Recordset
    Dim strSearchName As String
    Dim varSearch
    Dim varTaken
    Dim varHowMany
    Set db = CurrentDb
    

    Set rst = Me.RecordsetClone
    strSearchName = Str(Me!ID)
    rst.FindFirst "ID = " & strSearchName
        If rst.NoMatch Then
            MsgBox "Record not found"
        Else
            
         Me.Bookmark = rst.Bookmark
            varHowMany = rst!HowMany
            'Debug.Print varHowMany & " VarHowMany"
            'Debug.Print rst!HowMany
            varTaken = rst!Taken
            'Debug.Print rst!Taken & " rst!Taken"
           'Debug.Print varTaken
            varHowMany = CDbl(varHowMany) - CDbl(varTaken)
            
            'Debug.Print varTaken & " taken"
            'Debug.Print varHowMany & " HowMany"
            rst.Edit
            rst!HowMany = varHowMany
            Debug.Print rst!HowMany & " HowMany"
            rst!Taken = 0
            rst.Update
            
        End If
    rst.Close
End Sub
Posted
Updated 28-Mar-15 22:28pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900