Kamis, 08 Juni 2017

Re: [MS_AccessPros] Refering to subcontrols

 

John,
I tried it and it worked in one place but not all... I tire it here:

Private Sub Report_Open(Cancel As Integer)
    Me.RecordSource = Forms![frmMainMenu]![sfrmVendorMain].Form![sfrmVendorSearch].Form.RecordSource
    
    
    Me.OrderBy = Forms![frmMainMenu]![sfrmVendorMain].Form![sfrmVendorSearch].txtVendors_OrderBy
    Me.OrderByOn = True
   
    DoCmd.Maximize
End Sub

But no good.  It bombs on the Me.OrderBy = line. Object Not Supported.

With Warm Regards,
 
Arthur D. Lorenzini
IT System Manager
Cheyenne River Housing Authority
Wk.(605)964-4265  Ext. 130
Fax (605)964-1070

"Anyone who claimed that old age had brought them patience was either lying or senile."  







From: "John Viescas JohnV@msn.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com>
To: "MS_Access_Professionals@yahoogroups.com" <MS_Access_Professionals@yahoogroups.com>
Sent: Tuesday, June 6, 2017 2:16 PM
Subject: 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: Art Lorenzini <dbalorenzini@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)

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