Solved

AllowEdits problem

Posted on 2002-07-03
5
662 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…

743 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

18 Experts available now in Live!

Get 1:1 Help Now