472,802 Members | 1,457 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,802 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 1801
NeoPa
32,534 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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.