Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trap user mis-operation of subform

Status
Not open for further replies.

bradmaunsell

Programmer
May 8, 2001
156
US
I have a problem validating a control total on a subform when the operator does not tab away from the last amount entered.

This is a simple accts payable data entry screen that has a header and subform.

HEADER: Amount: $100.00

SUBFORM: Amount: $ 75.00
SUBFORM: Amount: $ 25.00

SUBFORM: SubTotal: $ 75.00 (on subform footer)

The subtotal on the subform has to equal $100.00 before exiting and I traps that work fine UNLESS the operator enters the $25.00 but remains in that cell and clicks a button on my form to SAVE THIS BILL. Actually, I can trap this piece of it, but keep reading and you will see there is more to it than meets the eye.

As you can seen, the second record has not been written so the subtotal hasn't been updated, so the proof balances are not note equal.

I have tried all sorts of events and routines attempting to trap this "mis-operation". Many work for some conditions but not for others. For example, suppose enteries are made correctly and subtotal box is upadted correctly making the proof totals match. BUT, now (before SAVE), the operator goes back and changes the $25.00 to $15.00.

At this point the code sees an in-balance test so saves one rec for $75.00 and one rec for $15.00. Not equal to $100.00 on HEADER.

So, the issue is how to trap an unfinished entry.

Any solution will be be greatly appreciated.

Brad
South Burlington, VT
 
Can you use the On Key Press event to update the subform subtotal? That way it would stay current no matter what the user does.
 
I know this is kinda a cheaters way out, but I always create a sub and button for my users to save files with. I then put the error catching code in there and display a msgbox appropriate to the error. Hope that helps!
 
Actually, I had used the cheater method already.

I tried the "On Key Up" unsuccessfully. The issue is that the key-up runs "me.refresh". Therefore, if I want to enter a value of 123, I get "1" then the subtotal updates, next I enter a "2" and instead resulting in "12" it updates to just "2".

For now, I will use the "button" unless a better idea turns up.

Thanks for the responses.

Brad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top