help writing a multiple table query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nico5038
    Recognized Expert Specialist
    • Nov 2006
    • 3080

    #16
    These are temporary tables, you'll also run into MSys.. tables, just ignore them.
    The IF is created to skip these.

    Nic;o)

    Comment

    • mbatestblrock
      New Member
      • Sep 2007
      • 164

      #17
      So all seems as if it correct? I dont get why it isnt working

      Comment

      • mbatestblrock
        New Member
        • Sep 2007
        • 164

        #18
        I posted this db on the net

        http://www.mykesdesign s.com/tblrock1/access/terminfo1.accdb

        Comment

        • nico5038
          Recognized Expert Specialist
          • Nov 2006
          • 3080

          #19
          Strange, looks like the tablename is Case sensitive, try:

          If Left(td.Name, 8) = "Terminfo" Then

          Can't test more as the linked tables aren't present...

          Nic;o)

          Comment

          • mbatestblrock
            New Member
            • Sep 2007
            • 164

            #20
            I believe I tried that, and it gave me a runtime error.. I am not at work anymore, and those files were on a network drive. Ill try it again tomorrow, and If it doesnt work ill post a few of those files for you.

            thanks you for everything!

            Comment

            • nico5038
              Recognized Expert Specialist
              • Nov 2006
              • 3080

              #21
              When you get an error, please post here the line, the errornumber and message.

              Nic;o)

              Comment

              • mbatestblrock
                New Member
                • Sep 2007
                • 164

                #22
                Hey nico,

                alright. I am all about screencaps, as you can tell.

                Here is the error after changing to a capitol T.

                http://www.mykesdesign s.com/tblrock1/access/module4.jpg

                and If I hit debug, it takes me here.

                http://www.mykesdesign s.com/tblrock1/access/module5.jpg


                --------------------

                here is a few terminfos if it would help

                http://www.mykesdesign s.com/tblrock1/access/terminfo22.txt
                http://www.mykesdesign s.com/tblrock1/access/terminfo24.txt
                http://www.mykesdesign s.com/tblrock1/access/terminfo25.txt

                Hopefully we can get this licked today!

                Originally posted by nico5038
                When you get an error, please post here the line, the errornumber and message.

                Nic;o)

                Comment

                • nico5038
                  Recognized Expert Specialist
                  • Nov 2006
                  • 3080

                  #23
                  Looks like the linked tables are causing trouble.
                  Just try to open one from the database window and see or that does work, otherwise relink them.

                  Nic;o)

                  Comment

                  • mbatestblrock
                    New Member
                    • Sep 2007
                    • 164

                    #24
                    I did both of those, and it is still giving me the same thing!! arggg

                    Originally posted by nico5038
                    Looks like the linked tables are causing trouble.
                    Just try to open one from the database window and see or that does work, otherwise relink them.

                    Nic;o)

                    Comment

                    • mbatestblrock
                      New Member
                      • Sep 2007
                      • 164

                      #25
                      Okay, so I am dinking around here trying out some lame things.. I think I may have found a really cheap way around this....

                      I have got it so that I have about 60 queries... each query is an office. the query returns the info that I need it to..

                      the query has, StorNum, TermName, Role, LastUpd

                      they work fine indidually.. how would I combine this all into ONE master query???

                      Comment

                      • nico5038
                        Recognized Expert Specialist
                        • Nov 2006
                        • 3080

                        #26
                        Assuming the queries are named "qryA2, "qryB", etc. use:
                        [code=sql]
                        select * from qryA
                        UNION ALL
                        select * from qryB
                        UNION ALL
                        select * from qryC
                        UNION ALL
                        ...
                        [/code]

                        Nic;o)

                        Comment

                        • mbatestblrock
                          New Member
                          • Sep 2007
                          • 164

                          #27
                          Great I will try this out tomorrow morning!

                          Originally posted by nico5038
                          Assuming the queries are named "qryA2, "qryB", etc. use:
                          [code=sql]
                          select * from qryA
                          UNION ALL
                          select * from qryB
                          UNION ALL
                          select * from qryC
                          UNION ALL
                          ...
                          [/code]

                          Nic;o)

                          Comment

                          • mbatestblrock
                            New Member
                            • Sep 2007
                            • 164

                            #28
                            Okay, so My queries are simply called

                            22
                            23
                            24
                            etc


                            so i typed in

                            SELECT * FROM 22
                            UNION ALL
                            SELECT * FROM 23
                            UNION ALL


                            I get an invalid syntax error, and it wont save,

                            Am I typing this in wrong??? I am in SQL view of a new query.

                            Comment

                            • nico5038
                              Recognized Expert Specialist
                              • Nov 2006
                              • 3080

                              #29
                              Better to use for your queries names like qry22, qry23, etc. Thus Access can't mix them with numbers. In your case you would probably have to add [ and] around the numbers to indicate it's a name and no number.

                              Nic;o)

                              Comment

                              • mbatestblrock
                                New Member
                                • Sep 2007
                                • 164

                                #30
                                This is what I have in the code

                                SELECT * FROM qry22
                                UNION ALL
                                SELECT * FROM qry23
                                UNION ALL


                                it gives me a "Syntax Error, Incomplete Query Clause"

                                I am missing something..

                                Comment

                                Working...