Only printing first 2 records of query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Darryl Bosch
    New Member
    • Jan 2012
    • 5

    Only printing first 2 records of query

    Hi All,
    I've got a Recordset that stores a summary (no duplicates) of a field in a query.

    This particulary field gives the index for the query/report that needs to be called, ie:
    1. I have a number of records that are of interest (pulled from the dB from a query)
    2. Each record in dB has a type, this type is the trigger for the query/report that needs to be run for it
    3. There are 16 types
    4. The recordset may not contain all 16 types.
    5. I created a summary of which types are in the recordset
    6. I only want to call the relevant query/reports
    7. I have done this with a case statement

    The issue is where the call is made to open the query and then open the report(in printpreview), I ony get the first 2 records from the query appearing in the report:


    iDisplayType = 2
    .
    .
    .
    .
    .
    Case Is = 17
    DoCmd.OpenQuery ("17 - General AO")
    DoCmd.OpenRepor t "17 - General AO", iDisplayType

    Can someone please let me know what is going on and why I'm only getting the first 2 elements
  • Darryl Bosch
    New Member
    • Jan 2012
    • 5

    #2
    I have just subscribed to this thread

    Comment

    • Rabbit
      Recognized Expert MVP
      • Jan 2007
      • 12517

      #3
      We need to see the query.

      Comment

      • Darryl Bosch
        New Member
        • Jan 2012
        • 5

        #4
        SQL of parent Query:
        SELECT CommRefQuery.In stallCompl, CommRefQuery.Co mmDocCirc, CommRefQuery.Co mmComplete, CommRefQuery.Co mmisioningItem, CommRefQuery.PT ermR, CommRefQuery.Ex tTag, CommRefQuery.Se ctInd1, CommRefQuery.[Comm Sht Ind], CommRefQuery.Ty pe, CommRefQuery.De scription, CommRefQuery.In stallComplDate, CommRefQuery.Me chFICReq, CommRefQuery.Me chFICPerformed, CommRefQuery.Co mmDocCirc, CommRefQuery.Co mmDocCircTo, CommRefQuery.Co mmDocCircDate, CommRefQuery.Co mmDocRcv, CommRefQuery.Co mmDocRcvDate, CommRefQuery.Co mmCompleteDate, CommRefQuery.Ca binet
        FROM CommRefQuery
        WHERE (((CommRefQuery .CommDocCirc)<> Yes));


        SQL of query who's report is only printing 2 records:
        SELECT CommChkShtGenQu ery.ExtTag, CommChkShtGenQu ery.PTermR, CommChkShtGenQu ery.[Comm Sht Ind], CommChkShtGenQu ery.Description , CommChkShtGenQu ery.Type, CommChkShtGenQu ery.Cabinet
        FROM CommChkShtGenQu ery
        WHERE (((CommChkShtGe nQuery.[Comm Sht Ind])="19"));


        All queries of this nature have the same error (the only difference is the [Comm Sht Ind] value they are pulling out.

        If you need more info, please let me know.

        Regards
        Darryl

        Comment

        • Darryl Bosch
          New Member
          • Jan 2012
          • 5

          #5
          I Should also mention that if I step through the code line, by line there is no problem, but if I run straight past the OpenReport line, then there is a problem.

          I have no idea what is going on.

          I were using a proper language, I'd compare the machine code from both the debug and non-debug compiles and see what's going on, but being a relative VBA noob, I'm more than a little stuck.

          Regards
          Darryl

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            Is there a reason you open the query before opening the report? Unless it's an action query, there's no need to open it.

            Comment

            • Darryl Bosch
              New Member
              • Jan 2012
              • 5

              #7
              I open the query so that I can double check that everything has worked properly, it the number of sheets in the print-preview matched the record count.

              I don't see how me opening the query prior to the report would change the fact that I only get 2 of the records when not debugging the code.

              Regards
              Darryl

              Comment

              • Rabbit
                Recognized Expert MVP
                • Jan 2007
                • 12517

                #8
                It could cause a lock on the records if both are attempting to access the same resource at the same time.

                Comment

                Working...