Solved

AllowEdits problem

Posted on 2002-07-03
5
664 Views
Last Modified: 2008-03-10
EE,
I have created a relational db in Access 2000.

My Order form has two subforms, Customer information and Order Detail information.

I would like to make the form read only when initially opened and then when I click a button make it editable or possible to "Edit Record" or "Add New Record."

I set the initially properties for the form AllowEdits to "NO"

I added a Button and in VB added Me.AllowEdits = True to the button.
It will allow me to edit information on the Form itself, but the subform of Order Details remains uneditable. The subform properties are set to "YES" for AllowEdits, AllowAdditions, and AllowDeletions.

If I use this button (called Allow Edits) or the Add New Record button (that I created), I may edit the information on the form itself, but not the subform.

Is it possible to do this, as I wish to be certain existing orders are not altered by accident, but I also want to add new orders or possibly edit existing ones.

Thanks very much.
dresdena1
0
Comment
Question by:dresdena1
  • 3
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
TheMek earned 75 total points
ID: 7126815
Hi dresdena1,

yes, this is possible. You have to explicitly set the AllowEdits of the subforms too when you press the button.

So if your subform-control is called 'Order Details' for example, under the button place:

Me.AllowEdits = True
Me.[Order Details].Form.AllowEdits = True

and for the second subform
Me.[Customer information].Form.AllowEdits = True

That should do the trick. If you have spaces in the name of your subform control, use square brackets otherwise you can leave those out.

Hope this helps,
   Erwin
0
 
LVL 5

Expert Comment

by:TheMek
ID: 7126818
Please note you have to use the Name of the subform-control and not the SourceObject (which can be different from eachother).
0
 

Author Comment

by:dresdena1
ID: 7128229
Erwin,
On an existing record it works great!
When I try to add a New Record the subform still doesn't load. Any idea why?

Thanks very much.
dresdena1
0
 
LVL 5

Expert Comment

by:TheMek
ID: 7129306
Not really, how can I reproduce this behaviour? Is it a big database? Maybe you could send it to me if it's not too big, so I can see the problem myself.

Greetings,
   Erwin
0
 

Author Comment

by:dresdena1
ID: 7129735
Erwin,
I have figured out the cause. I don't know why, but when I would try to Add New Record it would set the AllowEdits to Yes but the AllowAdditions to No.
I have added an extra line of code and now my Add New Record button works fine.
You can't add a New Record using the Access navigation arrows, but that isn't a problem anyway. I am a shortcut user. I have set all of my primary navigation to Button/Shortcut Keys anyway.

Here is what I added to the Add New Record and Edit Record buttons.
Me.AllowEdits = True
Me.[Order Details].Form.AllowEdits = True
Me.[Order Details].Form.AllowAdditions = True

It works fine now.

If you would still like to see the db, to see the cause that would be fine with me. Zipped it should only be about 300 or 400k. Just let me know your email address.

I will accept the answer that you originally gave above, because it definitely is what solved my problem.

Thanks very much!
dresdena1
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now