Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

AllowEdits problem

Posted on 2002-07-03
5
Medium Priority
?
692 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 300 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

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 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