By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,934 Members | 1,441 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,934 IT Pros & Developers. It's quick & easy.

How to correct locked subform to enter data

P: 87
I have an Access 2002 main form ("Project Initiation Checklist") with a subform ("sfPICMilestone"). The Link Child Field is ID and the Link Master Field is also ID. The linked field is an auto-generated number and the main form's primary key.

I'm having problems with my subform such that when I attempt to enter or edit data in its text boxes, its as if the subform is locked. Similarly, all controls on the main form are also locked. I can click on each control but cannot type or select, as required.

Perhaps there's something in the form or sub-form properties that I have to change, but I haven't been able to put my finger on it. I have a similar relationship for another set of forms/sub-forms but don't have this problem. Could there be any event procedures with the main form that are causing both forms to lock up when the sub-form is "activated"?

Help, please!!

Regards,

- JM
Feb 27 '08 #1
Share this Question
Share on Google+
4 Replies


Expert Mod 2.5K+
P: 2,545
...I'm having problems with my subform such that when I attempt to enter or edit data in its text boxes, its as if the subform is locked. Similarly, all controls on the main form are also locked. I can click on each control but cannot type or select, as required.

Perhaps there's something in the form or sub-form properties that I have to change, but I haven't been able to put my finger on it. I have a similar relationship for another set of forms/sub-forms but don't have this problem. Could there be any event procedures with the main form that are causing both forms to lock up when the sub-form is "activated"?...
Hi JM. It is certainly possible to set forms and subforms to non-updatable using event procedures. There are three main properties which can be toggled false or true which combine to set that form as read-only or updatable: AllowEdits, AllowAdditions, and AllowDeletions. If there are event procedures changing these properties you will see these listed against one or more of the On Open/Load/Current events in the form's properties tab, and the form's code module will contain the event handler code that actually changes their values (or calls another process to do so).

If the forms properties are set as you would expect and there are no event procedures stopping updates it would suggest that the recordsources are not updatable. Is the recordsource of the subform the related table, or is it a multi-table query? If it is a query, have the key fields been taken from the correct tables (the one-side tables?) I mention this because it is easy to include the key fields from the many-side table relationships, and this can lead to an apparently updatable query not allowing the addition of new records because of key faults, which in turn prevents the subform from working.

Let is know what you find.

Regards

Stewart
Feb 27 '08 #2

P: 87
Hi JM. It is certainly possible to set forms and subforms to non-updatable using event procedures. There are three main properties which can be toggled false or true which combine to set that form as read-only or updatable: AllowEdits, AllowAdditions, and AllowDeletions. If there are event procedures changing these properties you will see these listed against one or more of the On Open/Load/Current events in the form's properties tab, and the form's code module will contain the event handler code that actually changes their values (or calls another process to do so).

If the forms properties are set as you would expect and there are no event procedures stopping updates it would suggest that the recordsources are not updatable. Is the recordsource of the subform the related table, or is it a multi-table query? If it is a query, have the key fields been taken from the correct tables (the one-side tables?) I mention this because it is easy to include the key fields from the many-side table relationships, and this can lead to an apparently updatable query not allowing the addition of new records because of key faults, which in turn prevents the subform from working.

Let is know what you find.

Regards

Stewart
Thanks, Stewart. I found the AllowEdits property on the main form to be set on 'No'. Switching it to 'Yes' allowed me to 'unlock' the form.

My newest problem deals with the "ID" field, which is my linked parent and child field. On the main form, the ID field is the primary key and an auto-generated number. For example, if you have 100 records in a table. Activating the main form generates a new record with the ID field auto populated to the next number in the sequence, in this case: 101.

My problem is that I want the linked ID field on the subform to reflect the same number on the main form (i.e., 101), but it instead generates the next number in the sequence (i.e., 102). Is there a way to programmatically link the two ID fields together so that the same ID number is reflected on the main form and subform?

- JM
Feb 28 '08 #3

Expert Mod 2.5K+
P: 2,545
...My newest problem deals with the "ID" field, which is my linked parent and child field. On the main form, the ID field is the primary key and an auto-generated number. For example, if you have 100 records in a table. Activating the main form generates a new record with the ID field auto populated to the next number in the sequence, in this case: 101.

My problem is that I want the linked ID field on the subform to reflect the same number on the main form (i.e., 101), but it instead generates the next number in the sequence (i.e., 102). Is there a way to programmatically link the two ID fields together so that the same ID number is reflected on the main form and subform?
Hi JM. This new problem should properly be started as a new thread, so that it is available under the correct heading for others to search.
To return to your ID number problem, I wonder if the ID field in your linked table is also an autonumber? It would be very strange if it was, but I can think of no other explanation for differing values being created, unless there is something else going on in your form that is generating another record and hence setting the next autonumber.

The ID field of the many-side table matching an autonumber on the one-side table should simply be a Long value. In many years of using main form/subform combinations in various versions of Access I have not come across any similar problems with the parent-child field link - perhaps other contributors could come up with an alternate explanation?

Regards

Stewart
Feb 28 '08 #4

Expert Mod 2.5K+
P: 2,545
Postscript JM: If the mainform number is not the same as the subform surely you should not see the subform record at the same time as the main form record; if the mainform record is 101 then the subform record surely can't be showing 102 at the same time? To do so would violate the linking relationship. Odder and odder...

[font=Verdana][size=2]-Stewart[/size][/font]
Feb 28 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.