Wrox Programmer Forums
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 9th, 2003, 03:36 AM
Authorized User
Join Date: Jun 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to maha
Default Query to return 37 records

Hi all,

Good day. I need my query to return 37 records, even if the exact record is less than 37. For example, the query will search for my criteria and return few records. Say it is 5 records that matches my parameters. However, I need the query to give me 37 records. Which means 5 actual records and rest 32 is blank records.

How can I achieve that?

Old October 9th, 2003, 07:00 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG

You're going to have to write the output of the query to a table. If the table is not 37 records long, you'll have to run an append query to append X blank records to your table until you get 37 records.

To prevent the original query from giving you more than 37 records to start with, set the query property "Top Values" equal to 37.

OK, now I'm curious. Why would anyone want a query to give 37 records even though the true output may be less?

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Old September 10th, 2004, 02:00 AM
Friend of Wrox
Join Date: Jul 2004
Posts: 345
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to gokul_blr Send a message via Yahoo to gokul_blr

What is the basic need for that.

If you are having for the grid/window to display at a time.
Create tmp. table of displaying query fields only.
add first 37 or less from resultant query.
check for the no. of records in the tmp table if less add upto 37/no. of recors required.

Old September 10th, 2004, 02:37 AM
Friend of Wrox
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi

Dear it is very simple that you creat a loop which runs 37 time and in this loop you display your record one by one by adding a recordset and using if statement that if recordset.eof then it should not move to next record and simply continue the loop
I think you got my point if no then contact me without any hesitation. I would like to help you.

Love is the most precious thing of this world. So find it and grab it!

Similar Threads
Thread Thread Starter Forum Replies Last Post
Return Primary Key of Last Append Query mselkregg Access 1 November 16th, 2006 11:36 AM
Return from different records in same table rodmcleay SQL Language 2 October 10th, 2005 08:51 PM
Cannot display/return SQL Query Output from a Vari sjm SQL Server DTS 1 September 9th, 2005 11:40 AM
Query That Return 0 Rows in Results nimrod_r BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 June 5th, 2005 02:14 AM
looping through return records in sproc jtyson SQL Server ASP 5 July 14th, 2003 10:16 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.