473,890 Members | 1,370 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding empty records

7 New Member
A similar question to mine was asked before with one reply back in 2006. I tried to use the information provided but was unable to make it work.

I created a database to print out a report that is the same as the original hand written form. The problem I'm running into with this report is when the last record prints and there are no more additional lines (i.e. if the document has 15 lines to be filled out, and if I print
from Access with only 10 records entered, 10 lines is all I get.).

I'd like to complete the additional lines using empty records (5 records per the previous example) since there are many times we will need to add information to the report by hand after it has been printed and we will need the lines.

here is what I was attempting to use from a previous post.

Expand|Select|Wrap|Line Numbers
  1. Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
  2. If Me.MoveCount < intLineCnt Then
  3. Me.MoveLayout = True
  4. Me.PrintSection = False
  5. Me.NextRecord = False
  6. Me.MoveCount = Me.MoveCount + 1
  7. Else
  8. Me.MoveLayout = True
  9. Me.PrintSection = True
  10. Me.NextRecord = True
  11. End If
  12. End Sub
  13.  
  14. Private Sub PageHeader_Format(Cancel As Integer, FormatCount As Integer)
  15. Me.MoveCount = 0
  16. intLineCnt = CalcLinesToMove()
  17. End Sub
Any help would be much appreciated.

Thanks!
Jan 31 '13 #1
25 7127
Rabbit
12,516 Recognized Expert Moderator MVP
Use a union query to append blank records to the record source. No need to mess with code.
Jan 31 '13 #2
NeoPa
32,584 Recognized Expert Moderator MVP
If I'm not missing something, they would also need to restrict the number of records returned in the query to 15. This can be done using the TOP predicate of the SELECT clause. This can also be handled in the properties of a QueryDef by setting the Top Values property.
Jan 31 '13 #3
Rabbit
12,516 Recognized Expert Moderator MVP
Actually, though not stated, I believe the goal is to reach a multiple of 15. In which case, create a table with the numbers 1 through 15 and use a mod to return the number of blank rows you need to union.
Jan 31 '13 #4
NeoPa
32,584 Recognized Expert Moderator MVP
Rabbit:
I believe the goal is to reach a multiple of 15.
I'm inclined to agree, although the OP was specific in their explanation and that was for 15.

In case it's not clear though (and I had to think hard before I worked out what you might be suggesting), what I think you're suggesting is something like :
Expand|Select|Wrap|Line Numbers
  1. SELECT *
  2. FROM   [OPTable]
  3. UNION ALL
  4. SELECT TOP (14 - (((SELECT Count(*)
  5.                     FROM   [OPTable]) - 1) MOD 15))
  6. FROM   [Rec15]
Feb 1 '13 #5
Rabbit
12,516 Recognized Expert Moderator MVP
Essentially yes. But it would be 15 subtract the mod and only if the mod is not equal to 0.
Feb 1 '13 #6
NeoPa
32,584 Recognized Expert Moderator MVP
Rabbit:
But it would be 15 subtract the mod and only if the mod is not equal to 0.
And how would that be coded, other than how I suggested, without having to repeat the subquery?
Feb 1 '13 #7
Rabbit
12,516 Recognized Expert Moderator MVP
Sorry, you were right. I missed the -1.
Feb 1 '13 #8
frankiejj98
7 New Member
Thanks for the help but I am just not knowledgeable enough in this to be able to put it to use. Up to this point I have done everything using the wizards and it has been pretty fun... My experience using access is very limited. I like the idea of using queries though since I would not have to use the code, but I do not know how to implement this.
Thank you,
Frank
Feb 5 '13 #9
zmbd
5,501 Recognized Expert Moderator Expert
frankiejj98:
It's been such a long time since I was there with the Wizards as my friends. :)

OK, a small walk thru as I'd bet you're a tad shy on the SQL
- Create your second table as given in post 4
-Open the query editor.
-Change the view to SQL. -
[V2010] Ribbon, Create, Query, Design
Close the popup dialog without adding tables
You will now have a blank upper field and a grid below.
Easy way to SQL is to Right click in the field, select SQL View in the context menu. You can also select this from the Ribbon, or the bottom right hand corner.[/V2010]
-Copy and paste the SQL in the code box in NeoPa's post #5

Now here's where things will get troublesome if you don't know SQL so I'll do a break down:

SELECT * - This will select all of the fields in the table given in the table OPTable:
FROM [OPTable] You will need to change this to match your data table's name.
UNION ALL this is the magic that will allow you to get the empty records from the second table as given in post #4
SELECT TOP 14 Pull the first 14 records...
- ( less the calculated
((SELECT Count(*) returned count of the records in table OPTable by selecting all of records
FROM [OPTable]) from your data table Make sure you change the name!
- 1) subtract 1 from that number
MOD 15)) and calculate the remainder from 15 then append that number of records:
FROM [Rec15] the second table as given in post #4 and you will have to change this to the table name that you create.
Feb 5 '13 #10

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

Similar topics

2
2627
by: David | last post by:
Hi, I have an order form which has a field 'ProductID'. This form has a button on each record to open a new form linked by ProductID. This new form is a continuous form and obviously, only displays the records associated with that ProductID. Basically this is part of a Product Packing Pick System. From my products table, each product has a set default amount of items which
3
3731
by: grlgeek | last post by:
I have a report for creating the switchboard labels for our phone system receptionist switchboard. The template has 12 records per column. I setup a report that will create the labels and put a dotted line around them so the receptionist can easily cut them out. The report is setup with columns so that 6 columns fit across a page. 12 records per column, 6 columns across a page, each record has a dotted line around the box. The...
2
1428
by: Tor Inge Rislaa | last post by:
Prevent Adding new records in DataGrid Hi I have a DataGrid that I want to open for editing but the user should not be able to add new records. When I set the ReadOnly = False it is possible to edit but it is also able to add new records. How do I prevent that?
3
1354
by: Tull Clancey | last post by:
Hi, hope someone can help with the following, I'm a bit stuck! I have a database table (Access) with an AutoNumber field. When I add data to the table I want to use the AutoNumber field, format it and save the result in another field within the same record. Using SQL I can "Insert Into..." without a problem but Access doesn't have any call back features so I don't know what the AutoNumber field contains. In old ADO I used to open an...
2
1758
by: ET | last post by:
Hi! I'll need help on what todo with this information in table... There has to be a unique on one column (Item ID, for inventory purpose) but in many cases that ID is not known... thus, many empty records for that column exist in a table. I tried to create unique index (no duplicates), of course, it failed because of many empty records... Now, is there ANY way to keep those empty records, and allow new empty
1
1569
by: Brian Campbell | last post by:
I had a dataloss from a main table but had some backup records. I want to cut&paste say line: __33__|__01/04/99__|__165_|______KA__|__________WI___|__1251654_____ so that my table gets the record with out having to go field by field and looks like this: Zone | Request | ID | LocalName | ManagingOffice | LoanNum __39__|__08/04/98__|__542_|______NC__|__________WI___|__1255454_____
2
5076
by: Rico | last post by:
Hello, I'm formatting a report based on an existing controlled document. The document that I'm duplicating has a number of lines that the user fills our manually, but the database version of this document will fill the fields with data rather than the user hand writing entries. The problem I'm running into is when the last record prints, there are no more additional lines (i.e. if the document has 15 lines to be filled out, and if I...
3
2088
by: Flo100 | last post by:
Hi, I have a recordset which I have populated with a query. I have an empty recordset. I would like to take value of a field in every single record, which is a string. Search if the 4rth letter of the string is an 'a', and if yes add that record to the new recordset. Finally i want to output the resultset onto a report. I need some help please.
1
1870
by: mlangley | last post by:
Hi there. I am trying to figure out a way to create a series of empty records in a database (ACCESS 2003). Basically, the table has 10 years of information by id. However, if there is no ID, then there is no record. I would like to make a record that simply does not have any data in it in that case. For instance if have: ID YEAR DATA a 1 xxxxx a 2 xxxxx a 3 xxxxx a ...
2
2424
by: puT3 | last post by:
How can I make the report do not show any empty records? For example, in this table do not has address...I want the report only shows company that has address
0
9980
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11236
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10830
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10925
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9641
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6061
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4682
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4276
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3283
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.