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

Creating relationships with imported data - Please help I'm a newbie

153 100+
Hey :) hopefully someone can help me with this...I decided to take on the task of programming an access database for my legal co-op/internship...I'm studying law and music production on the side...most of the background I have in programming has to do with music production...

The program I'm creating pulls data from an excel sheet (with defined fields) and brings them into an access database. The data being pulled is the following:

FirstName|LastName|AssetTag|SerialNumber1|SerialNu mber2|SerialNumber3

From here the Asset Tags must correspond to a serial number (there are three different serial numbers because we get them from different locations...but they should all be the same)

The Serial Numbers contain the Asset Tags in between letters such as WAL0100020003LT. To remove the letters I wrote a module which I used in an SQL based query to remove the letters and place the revised Serial Number in a new table in a new column.

The First Name and Last Name are always entered with the Serial Number so they correspond in their rows.

I did not originally understand how Access works so when I was inputing the data where everything in the same row corresponded (including serial numbers), I thought I had a working program.

The program checks for null cells and when any row has a null cell there is a check value at the end of the row by which is used to arrange the results in ascending order so problems show up on top.

When I actually put the program to the test, when the rows with serial numbers did not match to the rows with asset tags (and first and last names), my world fell apart...the rows stayed together...it did not arrange based on relationships.

I am beginning to think that perhaps relationships are not the way to do this, but if relationships do not work in such a way I fear I will be in way over my head. Do relationships only work across tables?

If there's anyone who could offer me some insight, it would be greatly appreciated...I want to get this project completed before it is considered time lost or a wasted effort. In return if you ever need some electronic atmospheric music for a program you're writing, I'm your man.

Cheers,

Kosmös
Oct 27 '06 #1
5 1836
NeoPa
32,556 Expert Mod 16PB
Normally, if you create a query in Access, it will recognise relationships and automatically join the tables in a similar way.
Beyond that, no - only tables have the relationships.
Oct 27 '06 #2
MMcCarthy
14,534 Expert Mod 8TB
To create a fully cascading relationship in Access you must do the following using Table1 and Table2 as examples:


Table1
=====
T1_ID (PK must be unique)
Name

Table2
=====
T2_ID (PK must be unique)
Name
T1_ID (foreign key reference to PK of Table1)


There cannot be any data in Table2's T1_ID that is not present in Table1's T1_ID

Both fields must be of the same data type
Oct 28 '06 #3
Kosmos
153 100+
in response to this and the PM I sent you: Thanks for getting back to me but the problem is that if I create a primary key with autonumber I will run into a problem because I don't have every field arranged exactly the same way which is why I was suggesting adding a 0 to the asset numbers where there are missing numbers but now realize I will have more than one 0 which means I will run into problems with the primary key...maybe I could insert an autonumber in the empty rows instead? since the asset numbers are big numbers like 1983859384 and usually there won't be more than a couple of numbers missing, if any. Then for my later tests I could check if the number is less than 1000 then it is considered a missing value? but then again are there any other options you can think of because I wouldn't like to limit the user to anything although at the amount of missing asset tags currently, this company would have to be about 500 times bigger for this to be a problem.
Nov 2 '06 #4
Kosmos
153 100+
To create a fully cascading relationship in Access you must do the following using Table1 and Table2 as examples:


Table1
=====
T1_ID (PK must be unique)
Name

Table2
=====
T2_ID (PK must be unique)
Name
T1_ID (foreign key reference to PK of Table1)


There cannot be any data in Table2's T1_ID that is not present in Table1's T1_ID

Both fields must be of the same data type
Re: Creating relationships with imported data - Please help I'm a newbie
in response to this and the PM I sent you: Thanks for getting back to me but the problem is that if I create a primary key with autonumber I will run into a problem because I don't have every field arranged exactly the same way which is why I was suggesting adding a 0 to the asset numbers where there are missing numbers but now realize I will have more than one 0 which means I will run into problems with the primary key...maybe I could insert an autonumber in the empty rows instead? since the asset numbers are big numbers like 1983859384 and usually there won't be more than a couple of numbers missing, if any. Then for my later tests I could check if the number is less than 1000 then it is considered a missing value? but then again are there any other options you can think of because I wouldn't like to limit the user to anything although at the amount of missing asset tags currently, this company would have to be about 500 times bigger for this to be a problem.
Nov 2 '06 #5
MMcCarthy
14,534 Expert Mod 8TB
Thanks for getting back to me but the problem is that if I create a primary key with autonumber I will run into a problem because I don't have every field arranged exactly the same way
Kosmos

I don't understand what you mean. The Autonumber primary key is an independent identifier of each record in a table. It is not dependent on the data in that record. If you are talking about a sort order on the table then tables are not designed for that and it usually takes place in a query.

which is why I was suggesting adding a 0 to the asset numbers where there are missing numbers but now realize I will have more than one 0 which means I will run into problems with the primary key
Once you have an independent primary key you can use a default of 0 for the asset number. However, if you simply want to check for missing asset numbers I would suggest changing the data type to a text field and running a query based on something like:

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT * FROM TableName
  3. WHERE AssetNumber Is null OR AssetNumber= "";
  4.  
  5. OR
  6.  
  7. SELECT * FROM TableName
  8. WHERE Len(AssetNumber) < 2;
  9.  
  10.  
Nov 7 '06 #6

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

Similar topics

49
by: Mal | last post by:
Hi, As I gain knowledge through a lot of trial, error, and usenet posts.. I have a potentially odd question. I am using a commercial access application. It is a front-end / back...
4
by: Ronnie | last post by:
Ok let me just say first that I am a newbie in Access and I don't know much of SQL or VB programming. But I am trying to create this contact database using Access 97. I have created 2 tables,...
3
by: news.giganews.com | last post by:
Does anyone know if there's an easy way to export or copy the relationship structure from one mdb to a new one? The relationships in the db are time consuming to reproduce. I am trying to make a...
3
by: pemigh | last post by:
A while back I imported tables to a new database via Files-->Get External Data --> Import... All was well for several months, and then the database started behaving badly in a couple of ways,...
7
by: tfoale | last post by:
Hi. I'm a newbie trying to modify imported files in VBA (Access 2003) and struggling with it. I have a set of large CSV files (too large to handle in Excel) each containing data related to a...
10
by: Richard | last post by:
Hi folks, thanks for taking the time to read this (and hopefully point our where I'm going wrong). The scenario: I have a local Access2007 database which links in several read only mySql...
2
by: adwest | last post by:
Forgive me if this is a foolish question. I "play" in Access and have only created a few rather simple relational databases. My knowledge and experience is limited. I have no formal training, just...
2
by: John Google | last post by:
Hi, Access 2002. I import tables from another database where I only copy the definition and not the data. I select the Import Relationships option on the import dialog. After I do the...
2
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post by:
Have a complex process where I need to Import a large amount of data then run some transformations on this data then import into DataBase. The transformation involves multiple fields and multiple...
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: 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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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,...
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
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.