473,385 Members | 1,925 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,385 software developers and data experts.

How Do I Insert Blank Records in an Append Query

I've written a print program in another language to write every two records (orders) in a table on to a single sheet.

The problem is that the database file provided has customers with double orders and single orders mixed together. The VIPP program is unable to detect when there's a single record for a customer. Since I can't change the print program I need to change the data file so that each customer has two records.

I want to import the data file into an Access table and insert a blank row after single customer entries which I know violates database forms and normalization. Once I have two records for all customers, I can export the table out and insert the new records into the data file for print production.

Any takers?
Jan 17 '13 #1

✓ answered by ADezii

Stewart pretty much says it all. What you can do is to Insert a 'Blank' Record with a Unique Identifier such as OrderID to uniquely identify to whom/what the Blank Record refers to. This is accomplished by Inserting NULL Values into the appropriate Fields. This all depends on the Fields that will be accepting NULLs. They cannot be the Primary Key or component thereof, Uniquely Indexed, Required, etc. Here is how this can be done:
Expand|Select|Wrap|Line Numbers
  1. CurrentDb.Execute "INSERT INTO tblOrders ([OrderID], [Customer], [Order Date]) VALUES (9999, NULL, NULL)", dbFailOnError

4 8095
Stewart Ross
2,545 Expert Mod 2GB
There is no such thing as a blank record in a database - you are quite correct that storing such a thing would violate database design principles. Further, relational databases have no inbuilt concept of record position, as they are based on the principles of set theory where set membership has nothing to do with set position. It cannot be assumed that if you were able to write marker records of some kind that would indicate some form of 'blank' to be printed that these would be placed in the correct position that you need them, at least not without knowing a lot more about the sort order applied to the records stored.

-Stewart
Jan 17 '13 #2
ADezii
8,834 Expert 8TB
Stewart pretty much says it all. What you can do is to Insert a 'Blank' Record with a Unique Identifier such as OrderID to uniquely identify to whom/what the Blank Record refers to. This is accomplished by Inserting NULL Values into the appropriate Fields. This all depends on the Fields that will be accepting NULLs. They cannot be the Primary Key or component thereof, Uniquely Indexed, Required, etc. Here is how this can be done:
Expand|Select|Wrap|Line Numbers
  1. CurrentDb.Execute "INSERT INTO tblOrders ([OrderID], [Customer], [Order Date]) VALUES (9999, NULL, NULL)", dbFailOnError
Jan 17 '13 #3
Anas Mosaad
185 128KB
An old trick that might help. Create a new object of type view (query) that selects only the desired records and name it the same name as the object being selected from -of course you have to rename that object first.
For example, this query gets only customers with N entries:
Expand|Select|Wrap|Line Numbers
  1. select c_id from customers group by c_id having count(c_id) = [N]
  2.  
Jan 17 '13 #4
Rabbit
12,516 Expert Mod 8TB
I agree with not storing those blank records. Instead you can use a union query to add those blank records when needed.
Jan 17 '13 #5

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

Similar topics

8
by: Sans Spam | last post by:
Greetings! I have a table that contains all of the function permissions within a given application. These functions are different sections of a site and each has its own permissions (READ, WRITE,...
1
by: David Barger | last post by:
Greetings, It appears that an Append Query I run in Access XP is randomly failing to append a field. I have payroll data being entered into a payroll database. This data is exported daily to...
4
by: robboll | last post by:
When I try to use an append query from an oracle link it takes forever. I am exploring the idea of doing an append action using a pass-through query. If I have an Oracle ODBC connection to...
4
by: pmacdiddie | last post by:
I have an append query that needs to run every time a line item is added to a subform. The append writes to a table that is the source for a pull down box. Problem is that it takes 5 seconds to...
3
by: DHarris | last post by:
I created a continuous form in Access2003 based on a query that users review customers and once reviewed clicks on a command button that executes an append query to update a table of the reviewed...
11
by: kabradley | last post by:
Hello Everyone, So, thanks to nico's help I was finally able to 'finish' our companies access database. For the past week or so though,I have been designing forms that contain a subform and an...
3
by: ielamrani | last post by:
Hi, An append query is giving me the following error: qryPar can't append all the records in the append query qryPar set 0 field(s) to null due to at type conversion failure, and it did not add...
4
by: franc sutherland | last post by:
Hello, I am using Access 2003. I am having trouble trapping the "can't append all the records in the append query" error message when appending data to a query from a table which is linked to...
16
by: BNW | last post by:
I need help in finding out why I am not getting any data in my query. When I select all the fields in one table in my query grid and run it, the data is there. However, when I try to do it...
25
by: NDayave | last post by:
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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...

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.