Link to home
Start Free TrialLog in
Avatar of Chuck Lowe
Chuck Lowe

asked on

SUBFORM on ACCESS 2013

I'm working on an Access app (2013). I had to move a form with a subform/subreport under a form that also had a subform/subreport. I'm having issue recoding some. I can't find anywhere on the web or in books the keywords in the calls for !subcontent !subsection . Here is the code. Its dieing on the last Forms statement. I really need help with the documentation on how to call the forms and procedures correctly. Like I said I can't find info on !subcontent or !subsection.
I know it should be calling the UpdateRecoveryDetails of the current form I'm on but it errors out. The error states it can't find the procedure on the form (popup) that is calling it and it should be calling it from the subform that called the popup screen.

Public Sub RefreshRecoveryDetails(ByVal lngProjectID As Long)

    ' Refresh recovery details if it is visible.
    If (IsProjectOpen(lngProjectID)) Then
        If (Forms!frmMain!subContent!subSection.SourceObject = "frmProject_Quality") Then
           If (Forms!frmMain!subContent!subSection!subQualityInformation.SourceObject = "frmProject_Quality_Feedback") Then
                Forms!frmMain!subContent!subSection!subRecoveryInformation.Form.UpdateRecoveryDetails
            End If
        End If
    End If

End Sub
Avatar of crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access

make sure UpdateRecoveryDetails is PUBLIC. Not sure how your forms are nested but it looks like you are missing a few ".form" references ... try something like this -- and fix the other references too:
call Forms.frmMain.subContent.form.subSection.form.subRecoveryInformation.Form.UpdateRecoveryDetails()

Open in new window

you can also use a relative reference with Me and Parent
Avatar of Chuck Lowe

ASKER

@crystal (strive4peace)
Thanks for your info so far. Yes the UpdateRecoverDetails is a PUBLIC. As I stated I had to move this under another subform. I'm confused as to why you are using the Call and periods and our code uses "!" The original code worked before I moved it. I'm sure it's a simple thing as you said I'm missing something, probably simple. It looks like I'm loosing the current form it's on (under subform subRecoveryInformation).  I could try to figure it out myself  if I could find documentation  for using !subcontent, !subsection etc. I can't find that anywhere on the web or any manuals. That would be a great help.

So basically the process calls a subform (under SubQualityInformation) called frmProject_Quality_Feedback and that in turn can call up to 5 other subforms under (subRecoveryInformation). As I said it seems to be loosing the subform that I'm calling the popup screen from.

Is it not possible to have forms and subforms call other forms and subforms? Is there a limit or does it loose it's place?
I'm up against a project deadline and really could use all the help given.

Thanks in advance.
could you post a sample database or a labeled screenshot so we can visualize what you are trying to do?

anytime you reference controls on a subform, unless you want the container properties such as Left or Top, you should follow the formname with ".form"

bang vs dot ... I usually use .

>> Is it not possible to have forms and subforms call other forms and subforms? <<
yes but there may be an issue if the calling form is in dialog mode, sorry to say, since it must be closed before anything else can happen with another form ... perhaps change it to a procedure in a standard module?
@crystal (strive4peace)
Again thanks. I'll see what I can post (company security being an issue). As for your comment that forms and subforms can't call other forms and subforms may be an issue I have prepared for that circumstance and began coding around the issue but wanted to stay with the current company standards. But if not possible I will go that way.

As for my other question, can you point me to ANY link that explains the subcontent, subsection etc coding documentation? I can't find it anywhere!

Thanks again !
you're welcome, Chuck

>> can you point me to ANY link that explains ... <<

try this:
Access Basics
http://www.AccessMVP.com/strive4peace
Free 100-page book that covers essentials in Access
@crystal (strive4peace)
Thanks again.
 No where does it show subcontent or subsection ! I'm not sure why this is so difficult to find on the web or in any access documentation!
Or what order to call the Froms, subcontent, subsection etc. Very frustrating !
ASKER CERTIFIED SOLUTION
Avatar of crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for you help. You didn't directly answer my question but sure help me understand how the subforms work (even though I can't find documentation on it.)

My final solution was

Forms!frmMain!subContent!subSection!subQualityInformation.Form!subRecoveryInformation.Form.UpdateRecoveryDetails

I followed it through the debugger and it all works out.

Thanks again.