Full Version: Sub form properties
UtterAccess Forums > Microsoft® Access > Access Forms
akjollerstrom
Hi
I have some problems with a sub form. It would seem to be simple enough but I can see how to fix it.
I have tblMain, tblRootCause, frmMain and frmRootCauseSub
The idea is to have a sub form of RootCause in Main. Very standard, just a few lines with some text for each record. I have set the properties of frmRootCauseSub to AllowAdditions and AllowEdits and display it as datasheet in the subform.
But the strange thing is that I cannot edit or add data when in form view. If I change the sub form to single form view I am able to click the background in the sub form in form view and see that the properties AllowAdditions and AllowEdits are set as false. I go back to design view and the properties are true????
What is wrong here?
Thanks
Anders
akjollerstrom
Problem solved but not really understood....
included the following code in the OnOpen event of the main form.
CODE
    Forms![Main]![frmRootCauseSub].Form.AllowEdits = True
    Forms![Main]![frmRootCauseSub].Form.AllowDeletions = True
    Forms![Main]![frmRootCauseSub].Form.AllowAdditions = True

It's working but I don't really understand why there was a problem in the first place, appart from the obvious fact that the settings of the subform were somehow changed when the form opened.
Anders
Steve Schapel
Anders,
agreee this is very strange. I can only suppose that you have some other code running somewhere that is setting these properties.
By the way, with the code you gave, it could be simplified by using the Me keyword, like this:
CODE
   With Me.frmRootCauseSub.Form
      .AllowEdits = True
      .AllowDeletions = True
      .AllowAdditions = True
   End With
I know that's not answering your question, but just thought I would comment anyway! sad.gif
akjollerstrom
Thanks Steve!
If course, you are right about the cause to the problem and I assume that it has something to do with the function I use to open forms (where I also change the settings). But as the subform is not refered through that function and the settings applied are not inherited from the parent form, I realized that for now I should just be happy i found a way around it...
And thanks for improving my referencing techniques!
Anders
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.