AllowEdits issue, invalid property form/report and cannot find the form

  • Thread starter vincentt via AccessMonster.com
  • Start date
V

vincentt via AccessMonster.com

Wow... I have try out a lot of stuff and finally give up and ask for advices
from you all....

In the very beginining, i wrote the code as follow:
Private Sub btn_printold_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "student"
stLinkCriteria = "[sid]=" & "'" & Me![sid] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Form_student.AllowEdits = False
Form_student.AllowAdditions = False
Form_student.AllowDeletions = False

Form_order.AllowEdits = True
Form_order.AllowAdditions = True
Form_order.AllowDeletions = False

Form_receipt.AllowEdits = True
Form_receipt.AllowAdditions = True
Form_receipt.AllowDeletions = False

Form_student!tab_orderinfo.SetFocus

DoCmd.Maximize
DoCmd.Close acForm, Me.Name

It works fine, after I almost finished, I try it back and it failed. The
subform Order could not set, also the subform receipt inside the subform
order. So I search around and changed the inner code for Order and Receipt:
Forms!order.Form.AllowEdits = True
Forms!order.AllowAdditions = True
Forms!order.AllowDeletions = False

Forms!receipt.AllowEdits = True
Forms!receipt.AllowAdditions = True
Forms!receipt.AllowDeletions = False

or

Forms!student!order.form.AllowEdits = True
Forms!student!order.form.AllowAdditions = True
Forms!student!order.form.AllowDeletions = False ...................

All no luck, either comes out Invalid property Form/Report, or cannot find
the form "Order". For sure, I didn't change the name at all, and I try to
export all the a new blank database, the same.

Please help!!! My brain is going to bomb......................................
................................. Thanks! (anything unclear, do ask)

--
I am so new to Access... questions questions and questions...

Thanks always!

Message posted via AccessMonster.com
 
R

RoyVidar

Wow... I have try out a lot of stuff and finally give up and ask for
advices from you all....

In the very beginining, i wrote the code as follow:
Private Sub btn_printold_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "student"
stLinkCriteria = "[sid]=" & "'" & Me![sid] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Form_student.AllowEdits = False
Form_student.AllowAdditions = False
Form_student.AllowDeletions = False

Form_order.AllowEdits = True
Form_order.AllowAdditions = True
Form_order.AllowDeletions = False

Form_receipt.AllowEdits = True
Form_receipt.AllowAdditions = True
Form_receipt.AllowDeletions = False

Form_student!tab_orderinfo.SetFocus

DoCmd.Maximize
DoCmd.Close acForm, Me.Name

It works fine, after I almost finished, I try it back and it failed.
The subform Order could not set, also the subform receipt inside the
subform order. So I search around and changed the inner code for
Order and Receipt: Forms!order.Form.AllowEdits = True
Forms!order.AllowAdditions = True
Forms!order.AllowDeletions = False

Forms!receipt.AllowEdits = True
Forms!receipt.AllowAdditions = True
Forms!receipt.AllowDeletions = False

or

Forms!student!order.form.AllowEdits = True
Forms!student!order.form.AllowAdditions = True
Forms!student!order.form.AllowDeletions = False ...................

All no luck, either comes out Invalid property Form/Report, or cannot
find the form "Order". For sure, I didn't change the name at all, and
I try to export all the a new blank database, the same.

Please help!!! My brain is going to
bomb......................................
................................ Thanks! (anything unclear, do ask)

Subforms are not recognized as open forms, but as controls on the form
where it resides, so, you'll most likely need to refer through this.

Secondly, the name of the subform controls, can be different from the
name of the subform. So, if your subform control name is SubOrder, you
could probably use something like this:

Me!SubOrder.Form.AllowDeletions = False
Me!SubOrder.Form.SubRecipient.Form.AllowDeletions = False

or from another form, replace Me with

Forms!<name of main form>

and continue using fully qualified referencing.

One way of obtaining the correct reference, is to invoke the expression
builder from the main form, then doubleclick thrugh forms, loaded
forms,
the main form, subform <form> (or, continue to the sub-sub form), which
would result in something like

[SubOrder].Form
or
[SubOrder].Form![SubRecipient].Form

Then modify like above. Here's two links
http://support.microsoft.com/?kbid=209099
http://www.mvps.org/access/forms/frm0031.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top