473,398 Members | 2,393 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

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.OpenReport "17 - General AO", iDisplayType

Can someone please let me know what is going on and why I'm only getting the first 2 elements
Jan 6 '12 #1
7 1376
I have just subscribed to this thread
Jan 6 '12 #2
Rabbit
12,516 Expert Mod 8TB
We need to see the query.
Jan 6 '12 #3
SQL of parent Query:
SELECT CommRefQuery.InstallCompl, CommRefQuery.CommDocCirc, CommRefQuery.CommComplete, CommRefQuery.CommisioningItem, CommRefQuery.PTermR, CommRefQuery.ExtTag, CommRefQuery.SectInd1, CommRefQuery.[Comm Sht Ind], CommRefQuery.Type, CommRefQuery.Description, CommRefQuery.InstallComplDate, CommRefQuery.MechFICReq, CommRefQuery.MechFICPerformed, CommRefQuery.CommDocCirc, CommRefQuery.CommDocCircTo, CommRefQuery.CommDocCircDate, CommRefQuery.CommDocRcv, CommRefQuery.CommDocRcvDate, CommRefQuery.CommCompleteDate, CommRefQuery.Cabinet
FROM CommRefQuery
WHERE (((CommRefQuery.CommDocCirc)<>Yes));


SQL of query who's report is only printing 2 records:
SELECT CommChkShtGenQuery.ExtTag, CommChkShtGenQuery.PTermR, CommChkShtGenQuery.[Comm Sht Ind], CommChkShtGenQuery.Description, CommChkShtGenQuery.Type, CommChkShtGenQuery.Cabinet
FROM CommChkShtGenQuery
WHERE (((CommChkShtGenQuery.[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
Jan 6 '12 #4
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
Jan 6 '12 #5
Rabbit
12,516 Expert Mod 8TB
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.
Jan 6 '12 #6
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
Jan 7 '12 #7
Rabbit
12,516 Expert Mod 8TB
It could cause a lock on the records if both are attempting to access the same resource at the same time.
Jan 7 '12 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jason | last post by:
I have a table of 650,000 records associated to contracts. Some of the contracts have multiple records but each contract only has one Active Record (there might be several inactive records). ...
1
by: John M | last post by:
Hi, I have two incomplete lists of staff which combined create a full list of staff with duplicates. I wish to create a full list with no duplicates. Each member of staff has and obviously a...
3
by: Chuck Reed | last post by:
I have a MS Access data base that creates custom reports for clients in PDF form then prints the reports after all client's reports have been printed. The problem that I have run into is that when...
1
by: thesonofdad | last post by:
Hi all, Fun problem for everyone over the weekend - :) OK so I have the following SQL query in Access..... SELECT x.SURVEY_DATE AS , z.ORIG_CONST_DATE, z.ORIG_EXP_NO FROM . AS x, . AS z; ...
2
by: Certys | last post by:
Hello, I have a form where I only allow new records to be added. I enable this by setting the form property "Data Entry" to Yes. I want to access other records in the same table- to autofill...
2
by: HansyW | last post by:
Please help I m reading data and need to output to a file. For each record, I have a header and several details records. I need the header to be on one line, all the details on another line , and...
5
by: Nathan Sokalski | last post by:
I want to select only the first n records from a database using VB.NET. I have declared a DataTable and OleDB.OleDbDataAdapter as follows: Dim linkstable As New DataTable Dim linksadapter As New...
4
by: kdubble | last post by:
Hi I am trying to get the results of a query to show only unique student records (not duplicates). Is there a simple way to make the criteria field do this? I am not too familiar with SQL. ...
5
by: G33W1zz | last post by:
Hi, I'm trying to use foreach to write the results of a query to a csv file (fputcsv is not an option as my server is on php 4.7.4). Problem is that the second foreach returns ONLY the first...
0
by: Omendra | last post by:
Hi,I am creating my SP as dynamic, On that i am defining varchar(max) to need to get more than 8000 characters. But my SP is taken only 8000 characters when i am doing Print to my SP. Please...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.