Data in Index form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jahangir
    New Member
    • Oct 2006
    • 22

    Data in Index form

    I want to make index view of phone direcotory i.e. on a single form there are buttons from a to z.
    I hav make separete queries that shows results start from A, B respectivly.

    But how i can handel these queries on single form i.e. when i click A it run qery A and display corresponding records.when B.....so on

    Thx
  • tara99
    New Member
    • Oct 2006
    • 106

    #2
    Originally posted by Jahangir
    I want to make index view of phone direcotory i.e. on a single form there are buttons from a to z.
    I hav make separete queries that shows results start from A, B respectivly.

    But how i can handel these queries on single form i.e. when i click A it run qery A and display corresponding records.when B.....so on

    Thx
    One option is to create queries.
    for query A, set your criteria for qurery A.
    same for the rest of the queries
    display each query in a form (A,B,C,....)

    Then in the form, create buttons (A, B, C, D,etc.....)
    Private Sub A_Click()

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "formA"
    DoCmd.Openform stDocName, , , stLinkCriteria

    End Sub

    Or you can do it dynamically,

    Cheers

    Comment

    • Jahangir
      New Member
      • Oct 2006
      • 22

      #3
      These indexing i want to do in a single form, rather than open seprate forms for each buttons.

      Comment

      • tara99
        New Member
        • Oct 2006
        • 106

        #4
        Originally posted by Jahangir
        These indexing i want to do in a single form, rather than open seprate forms for each buttons.
        I have never done it myself and I don't have code for it but I think you can create few variable for each of your text boxes that you want to display information, and run sql statement and display those information in the text boxes for each of the button.

        hope it helps

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          Is the code in Access, or standalone VB?

          Comment

          • Jahangir
            New Member
            • Oct 2006
            • 22

            #6
            i m using MS access, in which vb coding facility available.

            Comment

            • PEB
              Recognized Expert Top Contributor
              • Aug 2006
              • 1418

              #7
              Hi,

              So you can change the recordset property of your form..

              In your A click even procedure you can write

              Me.recordset=AQ uery

              And so on..

              :)

              Comment

              • PEB
                Recognized Expert Top Contributor
                • Aug 2006
                • 1418

                #8
                Pardon

                Me.recordset="A Query"

                ;)

                Comment

                • Killer42
                  Recognized Expert Expert
                  • Oct 2006
                  • 8429

                  #9
                  Originally posted by PEB
                  Hi,
                  So you can change the recordset property of your form..
                  In your A click even procedure you can write
                  Me.recordset=AQ uery
                  And so on..
                  :)
                  Wouldn't it make more sense to use a single query, and pass the letter as a parameter? Or insert it into the query dynamically? Having 26 separate queries seems cumbersome.

                  Comment

                  • PEB
                    Recognized Expert Top Contributor
                    • Aug 2006
                    • 1418

                    #10
                    Originally posted by Killer42
                    Wouldn't it make more sense to use a single query, and pass the letter as a parameter? Or insert it into the query dynamically? Having 26 separate queries seems cumbersome.
                    Sure that it's better!

                    However if he has done 28 queries, why to say that his work isn't usefull?

                    :)

                    Comment

                    • Jahangir
                      New Member
                      • Oct 2006
                      • 22

                      #11
                      This all thing I can manage, But i need some usful functionality on from to get the result from 26 queries when click on correspond buttons. What function should i use??

                      Comment

                      • NeoPa
                        Recognized Expert Moderator MVP
                        • Oct 2006
                        • 32633

                        #12
                        Originally posted by Jahangir
                        This all thing I can manage, But i need some usful functionality on from to get the result from 26 queries when click on correspond buttons. What function should i use??
                        ??!???!???

                        Comment

                        • PEB
                          Recognized Expert Top Contributor
                          • Aug 2006
                          • 1418

                          #13
                          Hey,

                          On click property of the respective bouton you choose event procedure...

                          If you visualize in subform datasheet your query type

                          Me![Your Subform].Form.recordset ="AQuery"

                          Change Your Subform with the name of your subform
                          "AQuery" with the name of your query that invokes the names with A

                          And all this for the buton A the same thing for the others butons

                          :)

                          Comment

                          Working...