AllowDeletions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the following lines as part of an Event Procedure:
Forms![Physician].AllowDeletions = False
stDocName = "Physician"
stLinkCriteria = "[Physician_ID]=" & "'" &
Forms![SEL-Physician]![SelPhys] & "'"
DoCmd.OpenForm stDocName, acNormal, , stLinkCriteria

The first line of this sample causes and error saying that the form
Physician cannot be found.

Based on Access Help, the structure of the line is appears correct. I have
tried other lines as in: Forms("Physician").AllowDeletions = False with
the same results. I have triple-checked the spelling and cannot see the
problem.

Can someone tell me what I am doing wrong? Thanks.
 
Try this, move the line after the load of the form

stDocName = "Physician"
stLinkCriteria = "[Physician_ID]=" & "'" &
Forms![SEL-Physician]![SelPhys] & "'"
DoCmd.OpenForm stDocName, acNormal, , stLinkCriteria
DoEvents
Forms![Physician].AllowDeletions = False
 
My intention is to change the AllowDeletions of the form to prevent deletions
when the OpenForm is executed. If I understood the Help correctly, I should
be able to do this. Obviously, I would change it back after the OpenForm.
Please correct me if I misunderstood.

Thanks.


Ofer said:
Try this, move the line after the load of the form

stDocName = "Physician"
stLinkCriteria = "[Physician_ID]=" & "'" &
Forms![SEL-Physician]![SelPhys] & "'"
DoCmd.OpenForm stDocName, acNormal, , stLinkCriteria
DoEvents
Forms![Physician].AllowDeletions = False
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benefit from it.

Good luck



Martin said:
I have the following lines as part of an Event Procedure:
Forms![Physician].AllowDeletions = False
stDocName = "Physician"
stLinkCriteria = "[Physician_ID]=" & "'" &
Forms![SEL-Physician]![SelPhys] & "'"
DoCmd.OpenForm stDocName, acNormal, , stLinkCriteria

The first line of this sample causes and error saying that the form
Physician cannot be found.

Based on Access Help, the structure of the line is appears correct. I have
tried other lines as in: Forms("Physician").AllowDeletions = False with
the same results. I have triple-checked the spelling and cannot see the
problem.

Can someone tell me what I am doing wrong? Thanks.
 
Hi Martin
The "Forms![Physician].AllowDeletions = False" line will require an open
form, and this is why you getting the error message.
You need to set the AllowDeletion after the form is open, and there is no
need to set it up again to true after you close the form, unless you save the
form design while the form is running.

--
Good luck



Martin said:
My intention is to change the AllowDeletions of the form to prevent deletions
when the OpenForm is executed. If I understood the Help correctly, I should
be able to do this. Obviously, I would change it back after the OpenForm.
Please correct me if I misunderstood.

Thanks.


Ofer said:
Try this, move the line after the load of the form

stDocName = "Physician"
stLinkCriteria = "[Physician_ID]=" & "'" &
Forms![SEL-Physician]![SelPhys] & "'"
DoCmd.OpenForm stDocName, acNormal, , stLinkCriteria
DoEvents
Forms![Physician].AllowDeletions = False
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benefit from it.

Good luck



Martin said:
I have the following lines as part of an Event Procedure:
Forms![Physician].AllowDeletions = False
stDocName = "Physician"
stLinkCriteria = "[Physician_ID]=" & "'" &
Forms![SEL-Physician]![SelPhys] & "'"
DoCmd.OpenForm stDocName, acNormal, , stLinkCriteria

The first line of this sample causes and error saying that the form
Physician cannot be found.

Based on Access Help, the structure of the line is appears correct. I have
tried other lines as in: Forms("Physician").AllowDeletions = False with
the same results. I have triple-checked the spelling and cannot see the
problem.

Can someone tell me what I am doing wrong? Thanks.
 
Back
Top