D
David Whitaker
I have a subform in a form that is used to charge vehicles with certain
things. The subform is viewed in continious form and I have in the footer a
textbox that sums 1 field.
Problem
I am checking the subreports sum and comparing it to 2 other textboxes on
the main form by the following code that is put into the subforms 'on exit'
event.
Dim bytChoice As Byte
If Forms!cpurchase.costsubform!Text17 <> (Forms!cpurchase.qty -
Forms!cpurchase.onhand) Then
bytChoice = MsgBox("You Have Attempted To Charge a Total of " &
Forms!cpurchase.costsubform!Text17 + Forms!cpurchase.onhand & " " &
Forms!cpurchase.desc & "s when You Only Purchased " & Forms!cpurchase.qty &
" " & Forms!cpurchase.desc & "s. Do You Need To Adjust The Quanity That Was
Put in Inventory?", vbExclamation + vbYesNo, "Maintenance Manager")
If bytChoice = vbYes Then
Forms!cpurchase.onhand = ""
Forms!cpurchase.onhand.SetFocus
Exit Sub
End If
If bytChoice = vbNo Then
MsgBox "Please Check and Adjust How Many Was Charged To Each
Vehicle.", vbExclamation + vbOKOnly, "Maintenance Manager"
Cancel = True
End If
End If
Now, the code above is fine and works like it should, but the problem is
when I choose "no" and I go back and correct the amounts entered, if I tab
or click the next record in the subform, "I am assuming that it is saving
the entry", then when I click out of the subforms everything is fine, but if
I dont select the next record it shows the old values that existed before I
made my change and it becomes an endless loop.
I am wanting to think that the problem is in the "no" option of the control
but, how do you keep the cursor in that field until changes are made if they
selected that option(which keeps them in the subform) and save the record?
Thanks Ahead of Time
things. The subform is viewed in continious form and I have in the footer a
textbox that sums 1 field.
Problem
I am checking the subreports sum and comparing it to 2 other textboxes on
the main form by the following code that is put into the subforms 'on exit'
event.
Dim bytChoice As Byte
If Forms!cpurchase.costsubform!Text17 <> (Forms!cpurchase.qty -
Forms!cpurchase.onhand) Then
bytChoice = MsgBox("You Have Attempted To Charge a Total of " &
Forms!cpurchase.costsubform!Text17 + Forms!cpurchase.onhand & " " &
Forms!cpurchase.desc & "s when You Only Purchased " & Forms!cpurchase.qty &
" " & Forms!cpurchase.desc & "s. Do You Need To Adjust The Quanity That Was
Put in Inventory?", vbExclamation + vbYesNo, "Maintenance Manager")
If bytChoice = vbYes Then
Forms!cpurchase.onhand = ""
Forms!cpurchase.onhand.SetFocus
Exit Sub
End If
If bytChoice = vbNo Then
MsgBox "Please Check and Adjust How Many Was Charged To Each
Vehicle.", vbExclamation + vbOKOnly, "Maintenance Manager"
Cancel = True
End If
End If
Now, the code above is fine and works like it should, but the problem is
when I choose "no" and I go back and correct the amounts entered, if I tab
or click the next record in the subform, "I am assuming that it is saving
the entry", then when I click out of the subforms everything is fine, but if
I dont select the next record it shows the old values that existed before I
made my change and it becomes an endless loop.
I am wanting to think that the problem is in the "no" option of the control
but, how do you keep the cursor in that field until changes are made if they
selected that option(which keeps them in the subform) and save the record?
Thanks Ahead of Time