473,320 Members | 2,048 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,320 software developers and data experts.

Creating "empty records" in Access

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:

Expand|Select|Wrap|Line Numbers
  1. ID   YEAR      DATA
  2. a        1            xxxxx
  3. a        2            xxxxx
  4. a        3            xxxxx
  5. a        4            xxxxx
  6. b        1            xxxxx
  7.  
But I would like
Expand|Select|Wrap|Line Numbers
  1. ID   YEAR      DATA
  2. a        1            xxxxx
  3. a        2            xxxxx
  4. a        3            xxxxx
  5. a        4            xxxxx
  6. a        5 
  7. a        6            
  8. a        7            
  9. a        8            
  10.  
I have a table with just the year numbers in it that I tried to JOIN, or UNION, but that did not work because I could not figure out how to match the IDs to it (not in the years table). There are about 6000 IDs in the table that I am trying to manipulate.

I know how to do this using php or VBA code, but I am looking for a way to do if purely in SQL. Any advice that you guys have would be much appreciated.

Thanks
Nov 4 '07 #1
1 1836
Rabbit
12,516 Expert Mod 8TB
Table3 if your data. Table4 is a list of years.
Expand|Select|Wrap|Line Numbers
  1. SELECT y.*, Table3.Data INTO tbl_Test
  2. FROM [SELECT x.*, Table4.* FROM (SELECT DISTINCT ID FROM Table3) AS x, Table4]. AS y LEFT JOIN Table3 ON (y.Year = Table3.Year) AND (y.ID = Table3.ID)
  3. ORDER BY y.ID, y.Year;
  4.  
Nov 5 '07 #2

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

Similar topics

4
by: Marcin Dobrucki | last post by:
I've been having some problems with a parse error that I can't figure out (PHP 4.3.11 on Solaris9). Sample code: <?php // getting strange parse errors on this class A { var $value; function...
2
by: Jerry Boone | last post by:
Funny thing happened today... I thought I was going to be smart and customize my menu's by dragging the Refresh option from the Records menu onto the toolbar in Access 2000. When doing so, I...
0
by: jimmojelsky | last post by:
Access97 database - it is set up to share between several computers - some users have full access, others only have read access - locking is set at "no lock" - everything works unless one of the...
3
by: Vic | last post by:
Dear All, I have a database of laboratory records in Access 2000. There is one form which acts as an interface to input experimetal data. This form incorporates information from several tables....
8
by: Lyn | last post by:
I am trying to get my head around the concept of default, special or empty values that appear in Access VBA, depending on data type. The Access Help is not much (help), and the manual that I have...
7
by: Brad | last post by:
When debugging my current web project, in VS2003, I found I had lost the ability to drill down on watch objects in the Watch Window; I could only view the single value specific watch objects. ...
10
by: mcbobin | last post by:
Hi, Here's hoping someone can help... I'm using a stored procedure to return a single row of data ie a DataRow e.g. public static DataRow GetManualDailySplits(string prmLocationID, string
7
by: bbasberg | last post by:
Hello, I thought I would do a "sanity check" by asking the experts how to do the following: I need to process external data (it will be in an Access DB table and will be updated daily) into a...
1
by: psyvanz | last post by:
any code that can delete all records in just one click if you have a dataenvironment code it more good.. cause im working in this kind of code. like this: single delete code (not all in the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.