473,549 Members | 2,726 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Inserting blank records to query result for label printing

92 New Member
How do,

I have a form that outputs addresses in a format that can be printed on to 3x7 label paper for envelopes.

What I want is a way to enter blank (or " ") rows to the query result where the user specifies so no label is printed in that particular place.

I am aware of the problems of inserting blank records to tables. I say this as the other forums I have searched all reply with disbelief and condemnation for inserting blank rows into a database rather than offering support to the question asked.

I am not trying to store the blank rows, just insert them into the Report's record source at user specified intervals.


For example, the rows populate the labels as such:

Row 1 | Row 2 | Row 3
Row 4 | Row 5 | Row 6

etc

If there is no label in the space Row 3 would be printed on, I want to be able to output the rows as:

Row 1 | Row 2 | BLANK
Row 3 | Row 4 | Row 5

etc


Is there anyway of adding the blank record in at the correct place without resorting to creating a recordset line by line?

Many Thanks,


NDayave
Jun 8 '10 #1
25 7384
NeoPa
32,564 Recognized Expert Moderator MVP
Yes.

You can be creative in a query and build the labels report on the back of the query.

I don't think we have enough detailed info here to go much further for now, but it will probably involve a table of enough items to populate a full page at least. I'll stop there as I don't want to have to back-track when I get the details.
Jun 8 '10 #2
NDayave
92 New Member
Basically, I have a mailing list generator that produces a list of addresses based on the criteria selected.

Ie: Forename, Surname, Address1, Address2, etc, etc

The query is generated via VBA code based on the selections made by the user. As this involves both Individual Contacts and Organisations, there is the possibility of a Union being used, but not always.

Why would it require a full page worth of labels? I ask as they may only print a couple of labels in one sitting, but several pages in another.


What sort of information are you after?
Jun 8 '10 #3
NeoPa
32,564 Recognized Expert Moderator MVP
NDayave: Why would it require a full page worth of labels? I ask as they may only print a couple of labels in one sitting, but several pages in another.
I was thinking along the lines of a driving data source, that could be used to link your main data to. This may not be very clear so I will try to clarify :

A driving data source is one that you JOIN another source to, using either a LEFT or RIGHT JOIN (See SQL JOINs for more details of this). For now I will continue using the LEFT JOIN concept as that seems simpler to understand. If you want a blank record anywhere, the data source you use must be able to identify that item, and it would be set up so as not to find a matching record from your main data. With no details of how the items are identified (what indexes may be used) I'm not in a position to get into details.
NDayave: What sort of information are you after?
Some more detailed understanding of terms like user determined. On its own it provides no information at all. If you can explain how a user specifies this and what determines a selected item, then we have something we can build on.

Sometimes one cannot tell what data is required without the context of the question. That is why it is mainly down to you to include what is required. I can point to items that may be necessary, but other information, when supplied, may make some of that superfluous.

Using your example where record #3 should be blank, you need to consider what you have that could identify that record #3 is blank. but that all others match. This is true whether you do this via a table (creating blank records somewhere) or do it in a LEFT JOIN query.
Jun 9 '10 #4
NDayave
92 New Member
Well, I've made a very idiot proof query generator for use by the most computer illiterate people around. It functions by making sentences that correspond to the generated SQL.

Eg: Include | Organisations | Working in the Area of | Schools

returns the SQL that brings out all schools.

From here they can add more groups of individuals/organisations by adding more "Include" criteria, remove certain inds/orgs by adding "Exclude" criteria and refining either by adding "And" criteria.

Eg:
Include | Contacts | That are a part of | School 1
And | -------- | Aged | 11 to 15 years old
Exclude | Contacts | That are a part of | Event 1

Would return all the contacts aged 11-15 that go to School 1 and are not currently associated with Event 1.

When only Individuals are involved, the FROM and WHERE criteria is:

Expand|Select|Wrap|Line Numbers
  1. FROM (tblSource RIGHT JOIN ((tblContact LEFT JOIN (tblLinkType RIGHT JOIN tblLink
  2. ON tblLinkType.TypeID = tblLink.TypeID) ON tblContact.ContactID =
  3. tblLink.ContactID) LEFT JOIN tblSourceRel ON tblContact.ContactID =
  4. tblSourceRel.ContactID) ON tblSource.SourceID = tblSourceRel.SourceID) LEFT JOIN
  5. (tblOrg LEFT JOIN (tblOrgArea RIGHT JOIN tblOrgAreaRel ON tblOrgArea.OrgAreaID =
  6. tblOrgAreaRel.AreaID) ON tblOrg.OrgID = tblOrgAreaRel.OrgID) ON tblLink.OrgID =
  7. tblOrg.OrgID 
  8.  
  9.  
  10. WHERE ((((tblContact.ContactID IN ( SELECT tblContact.ContactID FROM tblContact
  11. INNER JOIN tblLink ON tblContact.ContactID = tblLink.ContactID WHERE (
  12. tblLink.OrgID = 10)))) AND (tblContact.ContactID IN ( SELECT tblContact.ContactID
  13. FROM tblContact WHERE ( DateDiff('yyyy', tblContact.DateOfBirth, Date()) -
  14. IIF(Format(tblContact.DateOfBirth, 'mmdd') > Format(Date(), 'mmdd'), 1, 0) >=
  15. 11)AND( DateDiff('yyyy', tblContact.DateOfBirth, Date()) -
  16. IIF(Format(tblContact.DateOfBirth, 'mmdd') > Format(Date(), 'mmdd'), 1, 0) <=
  17. 15))))) AND  ( tblLink.OrgID <> 25)
  18.  

The WHERE is generated in VBA from the Criteria list box on the form line by line adding in the correct bracketing and criteria to add the WHERE clauses in the correct order.

When Organisations are being selected as well as Individuals, the same thing happens with the relevant FROM and WHERE etc and is added as a UNION to the final output.

I am currently thinking about adding the search result to a recordset line by line and inserting the blank rows where specified, then basing the report on the recordset instead. Is there any other way of doing this?
Jun 9 '10 #5
NeoPa
32,564 Recognized Expert Moderator MVP
That'll teach me to ask for more info :D

There is much here to go through and I'm currently in a rush. I'll have to look at this again tomorrow (I'm out this evening) and see if I can understand enough to help you go forward with this. I won't ridicule the idea of using a temporary holding table for this though. Maybe we can find a purer solution, but often situations don't lend themselves easily to such solutions.

I think I'll enjoy going through this anyway. I love it when people come up with innovative - outside the box - type scenarios.
Jun 9 '10 #6
NeoPa
32,564 Recognized Expert Moderator MVP
As an addendum, would you mind posting a copy of your database for me to have a closer look. I can't help feeling this will be hard to explain clearly and easily without an example to play with. I include below some instructions on how best to do that on here (Not all may be 100% relevant in your case but it's a template post) :

When attaching your work please follow the following steps first :
  1. Please consider saving your database in a version not later than 2003 as many of our experts don't use Access 2007. Largely they don't want to, but some also don't have access to it. Personally I will wait until I'm forced to before using it.
  2. If the process depends on any linked tables then make local copies in your database to replace the linked tables.
  3. If you've done anything in steps 1 or 2 then make sure that the problem you're experiencing is still evident in the updated version.
  4. Compile the database (From the Visual Basic Editor select Debug / Compile {Project Name}).
  5. Compact the database (Tools / Database Utilities / Compact and Repair Database...).
  6. Compress the database into a ZIP file.
  7. When posting, scroll down the page and select Manage Attachments (Pressing on that leads you to a page where you can add or remove your attachments. It also lists the maximum file sizes for each of the allowed file types.) and add this new ZIP file.
It's also a good idea to include some instructions that enable us to find the issue you'd like help with. Maybe some instructions of what to select, click on, enter etc that ensures we'll see what you see and have the same problems.

PS. If you feel there is too much of a sensitive nature in it then feel free to ignore this request. It is simply to make the process easier. It's not a pre-requisite for posting or getting help.
Jun 9 '10 #7
NDayave
92 New Member
I have attached the relevant parts of the List generator and stripped most other things out. The lists can still be generated as they would normally.

I have PM'd the Zip password.

Let me know what you think.
Attached Files
File Type: zip Mailing Lists.zip (497.7 KB, 156 views)
Jun 11 '10 #8
NeoPa
32,564 Recognized Expert Moderator MVP
Thanks for this. I have also received the password safe & sound. I hope to get time to look at this properly over the weekend, after which I'll comment further.
Jun 11 '10 #9
patjones
931 Recognized Expert Contributor
Good morning,

Not to hijack the thread or anything, but I worked on this exact problem recently, except in the context of smaller mailing labels that come 30 to a page, arranged in three columns and ten rows.

My users were having the same problem...they would print out say five mailing labels, and the next time around need to start on the sixth label. So I made a label generator that would allow them to pick the row and column they wanted to start on and it works nicely.

Let me know if you're interested.

Pat
Jun 11 '10 #10

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

Similar topics

4
2276
by: John | last post by:
Anyone know why blank records would be input into the database from a form? Everytime I click submit I get 3 entries at a time entered in for no reason on top of the original data.
2
2408
by: Lin Ma | last post by:
Greetings, In my search application, user can type a number to search. I use LIKE in my query. If a query result generates over 10,000 recordsets, it may several minutes to run. Is there a way to only query certain recordset at a time?
11
13733
by: Surajit Laha | last post by:
I am firing a query like: SELECT TaskName, StartDate FROMTasks WHERE StartDate >= '01-Aug-2003' Now the result comes as: TaskName StartDate -------------------------- Task1 01-Aug-2003
4
1796
by: vito | last post by:
after executing the query, say it returns 1000 results. if i just want to do some sampling and like to have a look on 4 of them, how can i refer to these 4 random records out of 1000? i'm working on processing the result of $res_array which has 1000 records. query = select * from test; result = mysql_query(query);
4
2204
by: sparks | last post by:
I am trying to fix a database that someone did about 4 yrs ago in access97. The main table just contains demographics and is on the main form of the database. It has a subform on a tab that contains the other information. it is set 1 to 1 in the relationships. simplify if I can
2
3545
by: propoflady | last post by:
When I do the following union query - it works but it gives me blank records then my list SELECT , FROM BuyerListName UNION SELECT , FROM Buyers ORDER BY ;
1
1672
by: Simon Verona | last post by:
I have the requirement for address label printing within my software. I have a name and address list in a ado.net in-memory dataset - I'd like a pre-built software library which will display a number of label formats (eg Avery label formats) and then be able to mailmerge and print the labels. I'm willing to pay for a development licence for...
7
3008
by: Muddasir | last post by:
i am having problem in printing the query result from MySQL db... actually i am developing a very simple search module. when the user select category from the given categories in drop down list....the coresponding product against that category shuld be displayed.... table= search fields product_id, product_name, category_name, price
1
1621
by: CCHDGeek | last post by:
How can I tell if a query result empty (ie there are no records with the specified criteria). I want to change a form's design based on the result of the query it is based how. Does anyone know how I'd go about doing that? Thanks
0
7451
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7720
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. ...
0
7960
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...
1
7475
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...
0
6048
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...
1
5372
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3501
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1944
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
1
1061
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.