Selasa, 06 Juni 2017

Re: [MS_AccessPros] Refering to subcontrols

 

Art-


Try:

Forms![frmMainMenu]![sfrmMessageMain].Form![sfrmMessageSearch].Form.OrderBy

Note that the two subform names must be the names of the CONTROLS on the forms, which is not necessarily the same as the name(s) of the form(s) inside the controls.

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Jun 6, 2017, at 8:55 PM, dbalorenzini@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:




I am setting up a print command button but I am not sure I am referring to the sub controls correctly. The way it is setup I have my main form (frmMainMenu) and on it I have a subform called sfrmMessageMain  on which is another subform called sfrmMessageSearch. 


Here is my print code:


Private Sub cmdPrint_Messages_Click()
 If Me.txtMessages_OrderBy = "qrySearch_Messages." Then
     Forms![frmMainMenu].[sfrmMessageMain].[sfrmMessageSearch].Form.OrderBy = "qrySearch_Messages.ActivityDate DESC"
     Forms![frmMainMenu].[sfrmMessageMain].[sfrmMessageSearch].Form.OrderByOn = True
    
     End If
    
    


     If Forms![frmMainMenu].[sfrmMessageMain].[sfrmMessageSearch].Form.FilterOn And Len(Forms![frmMainMenu].[sfrmMessageMain].[sfrmMessageSearch].Form.Filter & "") > 0 Then
            
            
            DoCmd.OpenReport "Messages", acViewPreview, , Me.sfrmMessageSearch.Form.Filter
             DoEvents
            DoCmd.RunCommand acCmdZoom100
    Else
        
        DoCmd.OpenReport "Messages", acViewPreview
        DoEvents
        DoCmd.RunCommand acCmdZoom100
    
    End If
End Sub


When I run it I get Object does not support this property or method and in debug mode it highlights

Forms![frmMainMenu].[sfrmMessageMain].[sfrmMessageSearch].Form.OrderBy = "qrySearch_Messages.ActivityDate DESC"


Any ideas?


Thank you, 


Art Lorenizni

Sioux Falls, SD




__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar