HI
i am making a window aaplication using MS Access data base........
I have three combobox of Class, section and subject on form, now i want that when user first
select class ,then he selects any section corresponding to that class and then from the third
combo he could select any subject that corresponds to that particular section and class.
Now there is textbox and button thru which user could add student names one by one for the
subject,section and class which are selected in conmoboxes.

My problem is that whether I have to link the tables(class.section ,subject,student) in design view
of MSAcess or it will be done through coding so that we could add students for the particular
class-section-subject combination............

Kindly help me.i am newbie on databse.
So kindly help me regarding this...........

Recommended Answers

All 4 Replies

Hey abc16

I unfortunately dont know much about the MSAccess db. I kinda thought the MSAccess db was down and out. ie only used by legacy software. Ive been using Sql and its a dream to use. But thats neither here nor there.

If I understand correctly you want the sction combo box populated with specific fields depending on what is chosen in the class combo box, and like wise for the list in the subject combo box depending on what is chosen in the section combo box.

As I said I dont know how MSAccess queries work, but they possibly 'roughly' work the same.

I would disable the proceeding combo boxes until an item has been chosen from the preceeding combo box. Once an item has been chosen from the preceeding combo box run a db query with the chosen id to return the relavent results for the proceeding combo box. In this case the query would retun a filtered list depending on the id provided, for instance returning all Sections that are linked to that ClassID, or all subjects that are linked to that SectionID.

Once all the relavane choices have been made (and you now contain these ids for class, section and subject you should then be able to update that record in the db. Assuming your db table contains four columns (Class, Section, Subject, StudentName), and you had a method that took the same parameters.

Hope that helps and gets you going.

generally you should define the data structure in the database. You dont want disparate tables inthe database and a lot of coding to conncet a student with the class,etc.
If you have already defined the class/section/subject relationship in your database then adding the students should be fairly simple. Have a table to store students and a table to store the relationship between student and subject.

generally you should define the data structure in the database. You dont want disparate tables inthe database and a lot of coding to conncet a student with the class,etc.
If you have already defined the class/section/subject relationship in your database then adding the students should be fairly simple. Have a table to store students and a table to store the relationship between student and subject.

That is what i am asking Raysahd.....
Actually i am new on database, so can you plz tell me how can i make relation ship between tables?

How about this:

Class Table

ID	Name

0	Class_1
1	Class_2
2	Class_3
3	Class_4
.	...


Subject Table

SubjectID	ClassID 	Name

0		0		Subject_0
1		0		Subject_1
2		1		Subject_2
3		1		Subject_3
.		.		...

Section Table

SectionID	SubjectID 	Name

0		0		Section_0
1		3		Section_1
2		0		Section_2
3		1		Section_3
.		.		...

Student table

StudentID	SectionID	Name

0		0		Student_0
1		3		Student_1
2		0		Student_2
3		1		Student_3
.		.		...

<Possibly add the Subject and ClassID if you need this information>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.