Populate check boxes with values from a Recordset (1 Viewer)

Chrism2

Registered User.
Local time
Today, 22:08
Joined
Jun 2, 2006
Messages
161
Hello,

I have three tables; tblCourses ,tblCourseElements and tblElementnames

tblCourses contains details such as dates, locations.
tblCourseElements contains the descriptiveID of activities within a course and associates them with a courseID
tblElementnames simply stores the string describing the CourseElement


So, there can be many CourseElements in a Course. (Like, exams in a week, topics covered, group activities, etc).

I have a form for editing the Course, allowing the user to change the details, such as dates and location. Easy.

However, I need it to have a visual way of adding or removing CourseElements.

Now, there are 50 possible elements.

I have a form with 50 checkboxes, named chk1 to 50 - representing the ID of each elementname. (So we can use
Code:
Replace(ctl.Name, "chk", "")
to get the ID from the name if necessary).

When the form loads, I need it to get every CourseElement for that course, and set the relevant checkbox to true.

EG. If we edit CourseID = 5

and there are 4 CourseElements for CourseID(5) (say, 6,8,32 and 41)

I need chk6 = true
chk8 = true
chk32 = true
chk41 = true

I've never tried something like this before, so any help appreciated!
 

highandwild

Registered User.
Local time
Today, 22:08
Joined
Oct 30, 2009
Messages
435
It would be better to have another table which represents the course elements selected for a particular course and display them as a subform.

I have a form that will enable you to put the data together if you decide to go down this route.

Post some data.

Populating check boxes on the courses record is inflexible unless there is a compelling reason why you need to do this.
 

Chrism2

Registered User.
Local time
Today, 22:08
Joined
Jun 2, 2006
Messages
161
Yep, mad, crazy table design...

Have revisited it. Works much better if I store the true/false results as boolean in a seperate table and ditch the tblCourseElements and tblElementNames.

Thanks for helping. :)
 

Users who are viewing this thread

Top Bottom