hello!
I am designing an attendance system and i have a problem regarding marking the attendance. I don't want to use datagrid as i cant mark the attendance there ie i want to use checkboxes to mark the attendance. I'll provide a screenshot of how the form should look like. Can anyone tell me how do i do it?
when i choose the subject and month i want the data to be displayed from the database into the checkboxes.

Hi,
you can for Checkedlistbox control first load all the students from DB for that subject and then Get the student who are present, based on that mark the check boxes

You need to use 2 filed form database

1-student name (to populate the check box caption)
2-attendance (yes/no) (to populate the check box value)

Edited 5 Years Ago by debasisdas: n/a

I want to get the roll no's and names of the students in check-boxes. Depending on the number of students, that many check-boxes should appear automatically on the form. I have tried something like this..

Check1.Caption = Adodc1.Recordset.Fields("Name")
Adodc1.Recordset.MoveNext

Check2.Caption = Adodc1.Recordset.Fields("Name")
Adodc1.Recordset.MoveNext
Check3.Caption = Adodc1.Recordset.Fields("Name")
Adodc1.Recordset.MoveNext
Check4.Caption = Adodc1.Recordset.Fields("Name")

Try using Checked list box control. its very easy if you bind ur data from database..

Ok.
What datasource should i use in that case? i tried adodc and dataenvironment but getting errors like "unable to bind to field or datamemember".

Can you please tell me the steps? I am really stuck with this problem and cant go ahead with my project without solving this.
Thanks.

Use the following -

Dim Cn As New ADODB.Connection
Dim Rs As New ADODB.Recordset

Set cn = New ADODB.Connection
Set Rs = New ADODB.Recordset

With Cn
    .Provider = "Microsoft.Jet.OLEDB.4.0"
    .ConnectionString = "Data Source=" & App.Path & "\YourDatabaseNameHere.mdb"
    .Open
    .CursorLocation = adUseClient
End With

Rs.Open "SELECT * FROM YourTableHere",cn, adOpenStatic, adLockOptimistic

'Assuming that all your checkboxes is in an array with indexes (chkName(0) etc)
Dim xCount as Integer

For xCount = 0 To Rs.Recordcount - 1
If Rs!Attended = 1 Then '(true value)
chkName(xCount).Value = 1
Rs.MoveNext
Next xCount

Edited 5 Years Ago by AndreRet: n/a

Hey! Thanks alot.
But my problem isn't solved. What i want to do is once i select the subject and the month the names of the students taking that subject should appear in the checkboxes from the database. So that i can mark their attendance. The status for names which are checked should be updated in the database. that is LecturesAttended field should be updated from 0 to 1 and so on. The screenshot i have provided above.

Are you doing the actual selection of the check boxes, or do you want this to be done from the database? I'm still not sure exactly what you need. Where does the names go, into list box, and then you select the check box?

This article has been dead for over six months. Start a new discussion instead.