Solved

Access ODBC connection and relations in MySQL

Posted on 2004-04-11
3
255 Views
Last Modified: 2012-05-04
I have made a good connection from Access to a mySql database. I can put an Access form over a table in MySql, which gives me the opportunity to create, update, delete records in the MYSQL table perfectly. However the relations between the tables in the Mysql database are, if you look in the records, made by comma seperate values??

For example an employee can work in the building a to z. The actual buildings he is working in are written in the "building" field as i.e. A, D, G, Z. The tabel building contains the buildings details.

Is this the way Mysql is controlling relations or is this bad programming of the guy who made the (interactive) website (PHP) on top of this MSQ database ??
How can I tell Access that in this case a relation exists of an employee with building A,D,G,Z. Access sees only a field with comma seperate text??

With kind regards,

Pmagistra
0
Comment
Question by:Pmagistra
3 Comments
 
LVL 8

Accepted Solution

by:
jb79uk earned 250 total points
ID: 10801799
This sounds like a design choice by the creator of the database.  The alternative would be to have separate table to contain the relationships.

To get a recordset of the buildings each employee is related to, I'd do something like this:

SELECT BuildingTable.*, EmployeeTable.* FROM EmployeeTable INNER JOIN BuildingTable ON EmployeeTable.Building LIKE "*" & BuildingTable.ID & "*"

As I don't know the names of all the fields and tables involved this is only example SQL, but if you substitute the correct names it should work.
Replace:
'BuildingTable' with the name of the Buildings table
'EmployeeTable' with the name of the Employees table
'ID' with the name of the field in the Buildings table which contains the single letter code (A,B,C etc)

Hope this helps

JB
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question