Preventing Additions or Edits ... need help
Preventing Additions or Edits ... need help
am 01.02.2008 05:58:23 von Susan Bricker
Hi. I have a form that is open with AllowAdditions and AllowEdits both
set to False. I don't want to allow edits on this screen at this point
in the "flow". Opening up a second form seems to be affecting those two
attributes because when the 2nd form is closed the 1st form is then
'updatable' (is that a word?). What happened and how can I fix it?
Here are the details:
The form (frmDogs) has a command button (btnNewOwner) which when clicked
causes a second form (frmPeople) to open. Because the frmDogs is
"bigger" than frmPeople, I set the Visible attribute to False within the
btnNewOwner_Click( ) subroutine (before opening up frmPeople). That way
only the frmPeople is visible. Less distracting.
I open up frmPeople in Dialog mode to pause the processing in
btnNewOwner_Click( ) in frmDogs. I do this so that I may regain control
and "reposition" the recordset after frmPeople closes.
When the Close button of frmPeople is clicked, before closing itself
(and revealing frmDogs), it sets the Visible attribute of frmDogs back
to True. When I return to frmDogs, I am able to modify all the fields
on the form. NOT GOOD.
The question is HOW DID THAT HAPPEN? I don't want it to happen. I have
traced the routines and set a "Watch" break on the Me!allowadditions
variable (from within frmDogs) and the value never changes from False.
Help! I'm stumped.
Regards,
SueB
*** Sent via Developersdex http://www.developersdex.com ***
Re: Preventing Additions or Edits ... need help
am 01.02.2008 07:18:46 von Allen Browne
Sue, is there any chance that you have assigned a value to one of the fields
in frmDogs?
If you do, the record is now dirty (i.e. it has uncommitted edits.) When
this happens, Microsoft lets you finish the entry, even if AllowEdits or
AllowAdditions is set to No. If you think about it, that sort-of makes
sense: otherwise you would be stuck with a form that is partially filled in,
and unable to change it back or complete the entry.
To see if this is the issue, set the form's Record Selector property to Yes
so it shows the record selector panel at the left. When a form is dirty, the
record selector icon changes to a pencil (edit in progress.) So, when you
switch back to frmDogs, you can see whether it is in fact dirty or not.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Susan Bricker" wrote in message
news:1201841903_1527@sp12lax.superfeed.net...
> Hi. I have a form that is open with AllowAdditions and AllowEdits both
> set to False. I don't want to allow edits on this screen at this point
> in the "flow". Opening up a second form seems to be affecting those two
> attributes because when the 2nd form is closed the 1st form is then
> 'updatable' (is that a word?). What happened and how can I fix it?
>
> Here are the details:
>
> The form (frmDogs) has a command button (btnNewOwner) which when clicked
> causes a second form (frmPeople) to open. Because the frmDogs is
> "bigger" than frmPeople, I set the Visible attribute to False within the
> btnNewOwner_Click( ) subroutine (before opening up frmPeople). That way
> only the frmPeople is visible. Less distracting.
>
> I open up frmPeople in Dialog mode to pause the processing in
> btnNewOwner_Click( ) in frmDogs. I do this so that I may regain control
> and "reposition" the recordset after frmPeople closes.
>
> When the Close button of frmPeople is clicked, before closing itself
> (and revealing frmDogs), it sets the Visible attribute of frmDogs back
> to True. When I return to frmDogs, I am able to modify all the fields
> on the form. NOT GOOD.
>
> The question is HOW DID THAT HAPPEN? I don't want it to happen. I have
> traced the routines and set a "Watch" break on the Me!allowadditions
> variable (from within frmDogs) and the value never changes from False.
> Help! I'm stumped.
Re: Preventing Additions or Edits ... need help
am 01.02.2008 12:10:26 von Susan Bricker
Allen,
Thank you for the information. I just checked and yes the 2nd form was
issuing a REQUERY for one of the combobox controls in the 1st form. I
don't recall why I put that in, so I commented it out and the 1st form
displayed properly (correct data displayed) BUT the form was STILL DIRTY
and updatable. The only other update to the form is changing the
VISIBLE property of the form to TRUE so that the form appears when form
2 is closed.
Would you have a strategy that I could use to get that 1st form to be
'protected' when I return to it from form #2? I opened the 2nd form as
a DIALOG so that I would return to the btnNewOwner_Click( ) routine. I
trap it there upon return. Is there something I could there to insure
that the form #1 reverts back to "protected"?
Thanks.
Regards,
SueB
*** Sent via Developersdex http://www.developersdex.com ***
Re: Preventing Additions or Edits ... need help
am 01.02.2008 13:44:48 von Allen Browne
Good: you've confirmed that the problem behavior is caused by the form being
dirty.
Now it's a matter of tracking down what's making it dirty. Setting the
form's Visible property won't. Perhaps there is something else in one of the
form's events, e.g. Current, Activate or Deactivate. Alternatively, there
might be some code in frmPeople that assigns a value to a bound control in
frmDogs.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Susan Bricker" wrote in message
news:1201864226_1601@sp12lax.superfeed.net...
>
> Thank you for the information. I just checked and yes the 2nd form was
> issuing a REQUERY for one of the combobox controls in the 1st form. I
> don't recall why I put that in, so I commented it out and the 1st form
> displayed properly (correct data displayed) BUT the form was STILL DIRTY
> and updatable. The only other update to the form is changing the
> VISIBLE property of the form to TRUE so that the form appears when form
> 2 is closed.
>
> Would you have a strategy that I could use to get that 1st form to be
> 'protected' when I return to it from form #2? I opened the 2nd form as
> a DIALOG so that I would return to the btnNewOwner_Click( ) routine. I
> trap it there upon return. Is there something I could there to insure
> that the form #1 reverts back to "protected"?
Re: Preventing Additions or Edits ... need help
am 01.02.2008 13:54:33 von Susan Bricker
Allen,
Thank you for helping me work this out. It was (OF COURSE) a
coding/logic/programmer's error. The short of it ... I was overlooking
that within the btnNewOwner_Click routine (after returning from the 2nd
form) I was repositioning the recordset AND resetting the combobox
(updated the field). It turns out that I didn't have to. So, I
commented out that block of code because it was unnecessary.
The (short) backstory is that it WAS necessary before I started updating
these two forms to resolve a different "bug". I had changed the logic a
bit and left the unnecessary block of logic in.
The bottom line ... problem resolved ... thanks to you getting me back
on track. PHEW!!!
Thanks, so much.
Regards,
SueB
*** Sent via Developersdex http://www.developersdex.com ***