3587
Jan 29 2005, 10:12 AM
I have a continuos subform with a pay amt currency field and a button on the main form that saves all entries on the sub form. I need a way to make sure the pay amt field for each record on the sub form is greater than zero when the button on the main form is clicked.
Thank you,
tunkefer
Jan 29 2005, 10:20 AM
Assuming you have VB code in the button's OnClick event, you'll need something like this before the code that saves the data:
>If Me!subFormName!amountField = 0 then
> Exit Sub
>End If
TomU
3587
Jan 29 2005, 10:22 AM
But there is more than one record in the sub form, will this check them all?
Thanks,
tunkefer
Jan 29 2005, 10:23 AM
Oops. I just noticed that the subForm is continuous. Is just one line added at one time? If so, my earlier answer works. If not, more code is needed.
TomU
3587
Jan 29 2005, 10:27 AM
Yes there could be more than one record in the sub form.
Thanks,
tunkefer
Jan 29 2005, 10:30 AM
Since you're adding multiple lines to the subForm, I think the best place to detect the zero payment is in the BeforeUpdate event within the subForm. This will catch the condition in the current line before the user adds a new line.
TomU
3587
Jan 29 2005, 10:38 AM
I'll give that a try.
Thank you,
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.