Iura Rusu
Iura Rusu

Reputation: 95

Access Query, if text in column then write the data

Because this thing is due tomorrow I really need the help of our lovely community, right now I just started learning MS Access and SQL but encountered some difficulties.

What I want to do is a simple query, we can call it as a activity query, which will show us the activity of a member of the group in projects (proiect).

Here I have the table with the projects in which each member of a group participated.

enter image description here

enter image description here

The query I am trying to make has as the user input the ID of the member.

Let's say ( 12 )

What I would like to get is something looking like this :

enter image description here

The raw code is kinda like this

Get ID ( in our case 12 ). 
Analyze column ID-p-m; 
if ID-p-m LIKE Get-ID:
get- Nume Proiect , 
print in Took part : [Nume Proiect] + " -  Project Manager "  
Analyze column ID-p-t;
if ID-p-t LIKE Get-ID:
get- Nume Proiect ,
print in Took part : [Nume Proiect] + " - Project Team "

I can resolve the name part by myself, the hard thing for me is the " Took part:" thing... I really look forward to learning access and sql, but right now I need your help because this is due tomorrow.

Some literature on on how to do this, would also be awesome.

Upvotes: 0

Views: 36

Answers (1)

Andre
Andre

Reputation: 27644

Your table structure violates the First normal form, and this makes your query really difficult.

You should have:

Projects

ProjectID
ProjectName

People

PeopleID
PeopleName

Roles

This is a junction table to create the many-to-many relationship between Projects and People!

ProjectID
PeopleID
Role  (e.g. "Project Member" or "Project Manager")

With the right table structure, your query will follow almost by itself.

Upvotes: 1

Related Questions