2 Replies - 306 Views - Last Post: 28 January 2013 - 10:07 AM Rate Topic: -----

#1 mavinms  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 27-January 13

Display controls using loop and inserting records to Access DB, How?

Posted 27 January 2013 - 11:06 PM

Hi, I am working on one form where user will select class then section and then number of subjects for that class.
Basis on user selection no. of subjects for that class, I need to insert subject_name and max_periods to database in the single record,row, of class_section.

I have fields in my DB table: class, section, sub1,max1, sub2,max2, sub3,max3 ..... sub15, max15
Controls: textbox for class,section, sub_, max_
Combobox: to selcet no. of subjects
Buttons: Save, Delete

Thanks in advance,expert advise required.

Is This A Good Question/Topic? 0
  • +

Replies To: Display controls using loop and inserting records to Access DB, How?

#2 jgferguson  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 31
  • Joined: 11-July 12

Re: Display controls using loop and inserting records to Access DB, How?

Posted 28 January 2013 - 09:58 AM

Hi,

Question:- is the number of subjects per class always going to be 15 or will it vary depending on the choice of class?

The better way to do this would be to split the information into two tables in your Access DB:

Table1 - ClassInfo - the class name, section, a ClassID (number value as a primary key)

Table2 - SubjectInfo - Subject ID (number value as Primary Key), ClassID (number ID as Foreign Key; this is used to identify which class the subject is related to), SubjectName, SubjectMaxPeriods.

Thus you will then benefit from the designed flexibilities of a Relational Database such as MS Access.

If you are unsure I am sure there are plenty of tutorials that will advise accordingly on '1 to many' relationships in database design.

Hope this helps.
Jerry.
Was This Post Helpful? 0
  • +
  • -

#3 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 2881
  • View blog
  • Posts: 9,555
  • Joined: 12-December 12

Re: Display controls using loop and inserting records to Access DB, How?

Posted 28 January 2013 - 10:07 AM

My suspicion would be that section should be in a separate table and, possibly, that class and subject should be involved in a many-to-many relationship.

Whichever way you wiggle it, it needs a re-design from the ground up.

@OP if you insist on continuing with your current aim then you'll need to do some reading up on connecting to an Access Database. There may be a tutorial on this site but I haven't checked.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1