Subforms...

FLCoderMike

Registered User.
Local time
Today, 13:59
Joined
Nov 14, 2007
Messages
29
Here is my issue, I have a subform within a form that is within a subform, probably bad Access, but it works for what I need and my level of Accessdom. What I cannot get to work is the last sub to open. below is my path.

DoCmd.OpenForm [Forms]!mainForm.formContainerMain.ustax_orderSearch.searchReturn.[Form].ustax_searchReturn

mainForm->(subfrom)formContainerMain->(form)ustax_orderSearch->(subform)searchReturn->(form)ustax_searchReturn
I get an error stating "Object doesn't Support this Property or Method".

Any help is greatly appreciated.
 
What are you trying to do here? Open the 'sub-sub-form' independently of the main and sub forms?

If so then just
docmd.openform "NestedSubformsNameHerewithoutAllTheParentFormReferences",acNormal
ie

DoCmd.Openform "ustax_searchReturn",acNormal

If not then I don't understand what you're wanting to do with the command. If your main form is open then so should any subforms/nested subforms on it.
 
I want the form ustax_searchReturn form to open in the subform searchReturn.

Here is my code. It's a little rough, but works until I try and open the form in the subform.
Code:
Public Function recordCheck(strCriteria)

    Dim db As Database
    Set db = CurrentDb
    Dim rs As Recordset
    Dim strSql As String
    Dim strWhere As String
    
    Dim stDocName As String

        
        If strCriteria <> "" Then
        strWhere = " WHERE" + strCriteria
        Else
        strWhere = ""
        End If
    
        
        'Check to ensure there is a result to return
        strSql = "SELECT ustax_orderTBL.*, ustax_customerTBL.customerName FROM ustax_orderTBL INNER JOIN ustax_customerTBL ON ustax_orderTBL.customerID = ustax_customerTBL.customerID " + strWhere
        MsgBox (strSql)
        Set rs = db.OpenRecordset(strSql)
        Dim counter
        counter = rs.RecordCount
            
        
        
        
        If counter <> 0 Then 'Check for records to return
        Do While Not rs.EOF
        strMsg1 = rs.Fields("dateAdded")
        strMsg2 = rs.Fields("customerName")
        strMsg3 = rs.Fields("loanNumber")
        strMsg4 = rs.Fields("borrowerLastName")
        strMsg5 = rs.Fields("SSN")
        
        strMsg = strMsg1 & "," & strMsg2 & "," & strMsg3 & "," & strMsg4 & "," & strMsg5
        
        MsgBox (strMsg)
        rs.MoveNext
        
        Loop
        strForm = "[Forms]!mainForm.formContainerMain.[Form]!ustax_orderSearch.searchReturn.[Form]!ustax_searchReturn"
        DoCmd.OpenForm strForm
        Else 'Alert, there are no records
        strMsg = "There are no records to print, please refine your search"
        MsgBox (strMsg)
        End If
 
 End Function
 
I think you may have the beast by the tail here.

Subforms are either present or absent on another form. There's no such thing as 'opening' a subform within another form. However, you CAN hide or show a subform by setting the visible property of the subform control (container) to false or true depending on whatever parameters you need.


Code:
        If counter <> 0 Then 'Check for records to return
        Do While Not rs.EOF
           '...do something here
           rs.MoveNext        
        Loop
        [B]Me.ustax_searchReturn.Visible = True[/B]
        Else 'Alert, there are no records
        [B]Me.ustax_searchReturn.Visible = False[/B]
        strMsg = "There are no records to print, please refine your search"
        MsgBox (strMsg)
        End If
 
Thanks for the help. Now maybe you can help me again...
I am pretty new to Access and I am having a hard time figuring out how to take my query result and put it in the subform. I am a php/mysql guy, so this is a different kind of programming for me. I have read thru the forum and cannot seem to find how I do this.
 

Users who are viewing this thread

Back
Top Bottom