Solved

AllowEdits problem

Posted on 2002-07-03
5
675 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Familiarize people with the process of utilizing SQL Server functions 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 Ac…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

735 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