Link to home
Start Free TrialLog in
Avatar of dresdena1
dresdena1

asked on

AllowEdits problem

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
ASKER CERTIFIED SOLUTION
Avatar of TheMek
TheMek

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TheMek
TheMek

Please note you have to use the Name of the subform-control and not the SourceObject (which can be different from eachother).
Avatar of dresdena1

ASKER

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
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
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