Hi Jeanette,
Thanks for your persistence!
Yes you have the gist of what I am trying to achieve. Yes I have introduced
a command button to go to the next record.
What I observe from testing is that if, after entering/updating a percentage
value on the subform, the cursor is moved directly to the Next Record command
button on the Parent form, the command button code seems to runs before any
other event triggered code has an effect. This means that the total
percentage field has not updated to reflect the last input/edit and therefore
the command button total percentage test is invalid. If the cursor is clicked
in any irrelevant field before clicking the Next Record command button the
process works fine becuase the total percentage field has opportunity to
update.
I find that coding a Refresh for either the Parent or Subform as part of the
command button routine causes the total percentage field to go blank until
the command button routine is complete (which invalidates the percentage
check).
My dilemma seems to focus on a way of getting the total percentage field to
update/refresh before the command button code tests the value in the field.
If you've had enough of trying to nut out my problem I'll understand!!
Regards,
Terry
> With main form - subform setup in access, the subform record is saved as
> soon as the user clicks on the main form.
[quoted text clipped - 86 lines]
> >> > End If
> >> > DoCmd.GoToRecord , , acNext
Jeanette Cunningham - 29 Apr 2008 12:07 GMT
Terry,
another thing about access is that it puts a lower priority on updating
calculations in text boxes.
Try using the On Exit event of the subform to calculate the percentage like
this:
-->Me.Recalc
The Recalc forces access to calculate, you can look it up in the vba help.
If you still find that the user can click on the main form's nav buttons
before the calculation is made, then I suggest you do away with the default
nav buttons and make your own. That way you can control what happens when
they are clicked.
Another way would be to separate the main form and the subform.
The main form could be used to open the subform as a form instead of a
subform.
The main form is closed or hidden while the user edits/updates the second
form.
This way the user doesn't have any way of closing the second form except
from its close button.
You can put the code to check the % on the close button.
Jeanette Cunningham -- Melbourne Victoria Australia
> Hi Jeanette,
> Thanks for your persistence!
[quoted text clipped - 140 lines]
>> >> > End If
>> >> > DoCmd.GoToRecord , , acNext
TESA0_4 - 30 Apr 2008 01:42 GMT
Jeanette,
Success!
Throughout this whole discussion I have only been trying to achieve the 100%
test using a custom command button. Based on your most recent reply I
inserted:
tblPackageZonessubform.Form.Recalc
at the start of my command button code. It forced the upadate of the text
filed on the subform causing the percentage check to a valid test.
Thanks for your persistence and assistance. There seem to be SOOOO... many
methods and options with Access.
Regards,
Terry
> Terry,
> another thing about access is that it puts a lower priority on updating
[quoted text clipped - 165 lines]
> >> >> > End If
> >> >> > DoCmd.GoToRecord , , acNext