Cascading Combo Box Filtering

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dgaletar
    New Member
    • Jan 2013
    • 72

    #16
    OK, so you are saying that I need to change the name of the table only in the query to "Me.Department" ?

    Comment

    • dgaletar
      New Member
      • Jan 2013
      • 72

      #17
      Oh!!! You are right! It is just named "VEHICLE DETAILS". Ooops!

      Comment

      • dgaletar
        New Member
        • Jan 2013
        • 72

        #18
        OK, now we are cooking with gas! I changed the name in the query and ran it and it returned a value of 4.

        Comment

        • dgaletar
          New Member
          • Jan 2013
          • 72

          #19
          OK, I also changed the table name in the Macros box. Got the same error with the same line highlighted:

          Code:
              .RowSource = strSql

          Comment

          • Seth Schrock
            Recognized Expert Specialist
            • Dec 2010
            • 2965

            #20
            Me.Department is a reference to a control on the current form, not a table name.

            Here is what the query needs:
            SELECT - your fields names. Currently asking for the field CUA#
            FROM - the name of the table where your selected fields can be found, currently listed as "VEHICLE DETAILS : Table" but this is wrong
            WHERE - the criteria that specifies which records to be selected

            You need a valid table name for the query to get records from. You need valid field names from the table you are querying to SELECT and to set criteria by in the WHERE clause. I don't know what tables names you have or the fields names so I can't tell you what exact text needs to go in the query.

            Comment

            • Seth Schrock
              Recognized Expert Specialist
              • Dec 2010
              • 2965

              #21
              Cross posted again :)

              So did your query work and did it return the records you wanted?

              Comment

              • dgaletar
                New Member
                • Jan 2013
                • 72

                #22
                Got it. Here's what I have listed in the SQL view of the query:

                Code:
                SELECT [CUA#] FROM [VEHICLE DETAILS] WHERE [CUA#]=[Department]
                ...but when I run the query, it only returns an empty box labeled CUA#.

                I imagine that I now need to connect the query to the form with the drop down box, right?

                Comment

                • Seth Schrock
                  Recognized Expert Specialist
                  • Dec 2010
                  • 2965

                  #23
                  Instead of [Department], put 4 as this is what Me.Department equals.

                  Comment

                  • dgaletar
                    New Member
                    • Jan 2013
                    • 72

                    #24
                    Got it. Here's what I have listed in the SQL view of the query now:

                    Code:
                    SELECT [CUA#]
                          FROM [tblVEHICLE DETAILS]
                          WHERE [CUA#]=4
                    ...and when I run the query, it returns a 4 in the box labeled CUA#.

                    Comment

                    • Seth Schrock
                      Recognized Expert Specialist
                      • Dec 2010
                      • 2965

                      #25
                      In tblVEHICLE DETAILS, is there a field titled CUA#?

                      Comment

                      • dgaletar
                        New Member
                        • Jan 2013
                        • 72

                        #26
                        OK, I can't seem to post to this list anymore. I have posted the same thing 3 times and it is showing up in the other forum topic.

                        Comment

                        • dgaletar
                          New Member
                          • Jan 2013
                          • 72

                          #27
                          Yes. It is the Primary Key for the table. Department is also in this table, although it is a drop down list, drawing it's info from the table Departments.

                          Comment

                          • Seth Schrock
                            Recognized Expert Specialist
                            • Dec 2010
                            • 2965

                            #28
                            Oh, Duh. I can't believe I missed that. What other fields in tblVEHICLE DETAILS do you want to see in your combo box? You will need to enter those field names in the SELECT portion of your query as well.

                            What other forum topic are you talking about?

                            Comment

                            • dgaletar
                              New Member
                              • Jan 2013
                              • 72

                              #29
                              The last one... the forum topic where we were originally.

                              Anyway, that is the only field that will need to be seen. The idea is that they select the department from the first drop down list. Then, they move to the next drop down where the CUA#'s are populated for that department.

                              Although we haven't gotten this far yet, once they select the CUA# that they want from that list, it opens the appropriate form for that vehicle.

                              Comment

                              • Seth Schrock
                                Recognized Expert Specialist
                                • Dec 2010
                                • 2965

                                #30
                                Oh, we are in the same forum topic, just page 2. Each page only holds 25 posts.

                                Something seems strange with the way you are designing this database. Can you list the fields in tblVEHICLE DETAILS along with their data types for me? I have a guess of what is wrong, but I would like to check the list before going further.

                                Comment

                                Working...