Creating a Command that will Run a Top 20 Query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sharkiness
    New Member
    • Sep 2008
    • 19

    Creating a Command that will Run a Top 20 Query

    Hi,

    I have been creating a database in Access 2003, I have created a form that will show information about a company. On this I have created a Command Button that will a form of the customer details for the relevant company that is shown on the form. I have the code below which is from a wizard

    Code:
    Private Sub Disclosures_Click()
    On Error GoTo Err_Disclosures_Click
    
        Dim stDocName As String
        Dim stLinkCriteria As String
    
        stDocName = "Customer Details"
        
        stLinkCriteria = "[FINANCIAL INST NAME]=" & "'" & Me![Financial Institution] & "'"
        DoCmd.OpenForm stDocName, acFormDS, , stLinkCriteria
        
    Exit_Disclosures_Click:
        Exit Sub
    
    Err_Disclosures_Click:
        MsgBox Err.Description
        Resume Exit_Disclosures_Click
        
    End Sub
    What I would like to do now is create another command button that will open a datasheet view as before but just to show the top twenty customers by highest balance. The field for highest balance is simply named 'Balance'

    Hopefully you can help.

    Cheers
    Last edited by Stewart Ross; Sep 12 '08, 09:36 AM. Reason: corrected closing code tag to [/code]
  • Sharkiness
    New Member
    • Sep 2008
    • 19

    #2
    Sorry first paragraph wasnt clear

    I have created a command button that will open a form in datasheet view

    Comment

    Working...