Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

No-edit on form doesn't work for sub-form objects

Status
Not open for further replies.

WaltW

MIS
Jun 14, 2000
130
US
We have a MS Access form that contains some sub-form objects. We do NOT want to allow edits in this form once a record is entered - when we set "Allow Edits" on the form to No, it works fine for all objects except for sub-forms. Is there some way we can set it up so no edits are allowed on a sub-form object, like the rest of the form? Thanks!
 
How are ya WaltW . . .

Your problem is when to block edit of the subform. I see the user entering as many records as needed in the sunform, and then hitting a comad button that will lock as necessary. Hope this is apparent! The schema involves adding two boolean fields to the underying tables. One for the mainform, one for the subform. These checkboxss will be set in finality of saving records. Code will look at these checkboxes and determine wether to [blue]Allow edits[/blue].

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
I guess my question is are the sub forms returning information related to anything in the parent from, or are these used to also enter data. Without knowing more about your specific needs its hard to place a solution. The sub forms are objects just as much as the parent form. This means that they will have their own properties and settings that are separate from the parent from. You can try several things, but again, without knowing more about the sub forms role, it will be difficult to ascertain your needs.

1. Highlight the form in design view and press F4 to view the properties window for the sub form.

2. Design your sub form as a stand alone form and set the properties as you wish. Any changes made to that form will cascade up to the sub form copy. Then use the wizard on your main forms tool bar and select add sub form. From the wizard, select use current existing form, and select the form you are after.

3. If the sub form is taking data, I would suggest using the After Update Event and/or Lost Focus Event for the sub form and set the enabled property to false.

I hope this helps. I'll check on you in a few days. Let me know if I can help more.
 
WaltW . . .

Perhaps this will do in the [blue]AfterUpdate[/blue] event of the mainform:
Code:
[blue]   Dim ctl As Control
   
   For Each ctl In Me.Controls
      If ctl.ControlType = acSubform Then
         ctl.Form.AllowEdits = False
      End If
   Next[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top