Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


4 posts

Wannabe Geek


Topic # 31377 15-Mar-2009 23:16
Send private message

I have a database with:
Tables
Contacts {Name, Address, Phone Number, ID} etc
Jobs {Job Number, Name, Adress Phone Number, Job Description} etc

How do I create a JOB form where when I enter the name which is linked to the contacts and the address from that name comes up Automatically.

Create new topic
10 posts

Wannabe Geek


  Reply # 201371 16-Mar-2009 09:20
Send private message

Tables
Contacts {Name, Address, Phone Number, ID} etc
Jobs {Job Number, Name, Address Phone Number, Job Description}

You need to add a relationship between the tables.
[Contacts] 1 or many [Jobs]
[Jobs] must have 1 [Contact]
(not going to deal with many to many possibility)

Hence:
Contacts {Name, Address, Phone Number, ID} etc
Jobs {Contact_ID, Job Number, Name, Address Phone Number, Job Description}

Contact_ID in the Jobs table is the foreign Key to the Contact table ID field

Sample query (not tested or checked)

Select [Contacts].[Address]
From [Contacts],[Jobs]
Where [Contacts].[ID]=[Jobs].[Contact_ID] And [Jobs].[Name] = input


Hope this helps


edit reason: formating

8027 posts

Uber Geek
+1 received by user: 387

Trusted
Subscriber

  Reply # 201419 16-Mar-2009 14:26
Send private message

I would imagine you will invariably have a situation where a contact has many jobs and a job can have more that one contact. 

For many to many relationships you just need a joining table like JobContact, eg:

  Contact [ContactID, Name, Address, PhoneNumber, WhenCreated, WhenModified, CreatedBy, ModifiedBy]

   Job [JobID, Name, Adress Phone Number, Job Description, WhenCreated, WhenModified, CreatedBy, ModifiedBy]

   JobContact [JobID, ContactID, WhenCreated, WhenModified, CreatedBy, ModifiedBy]

A couple of coding conventions that I normally stick to are: don't make table names pural, add some basic logging fields so you can at least tell who last modified it and who created it (Created/Modified).

10 posts

Wannabe Geek


  Reply # 201422 16-Mar-2009 15:07
Send private message


Windkyle You seem to be learning many different technologies and languages and concepts,

I recomment you look at FunctionX website as they have alot (450mb) of tutorials that i think will assist you.

Good luck in the learning!

397 posts

Ultimate Geek

Trusted

Reply # 201426 16-Mar-2009 15:17
Send private message

Also bytes.com  (formerly know as thescripts.com) is another forum with a wealth of information & quick/ friendly advice relating to MS Access/ Excel queries...




Cheers, Stevo



4 posts

Wannabe Geek


Reply # 201514 16-Mar-2009 22:14
Send private message

Yep definately trying to learn as much as possible. Ive recently started my own little PC repair business, im pretty good at Diagnosing problems with hardware and software. This is my website let my know what you guys think, and what do you think it would cost to build it. www.pcworld.co.nz. I really appreciate your guys help Cool

Create new topic

Twitter »

Follow us to receive Twitter updates when new discussions are posted in our forums:



Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:



Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:



Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.