B
B
bender30002016-10-16 12:53:52
System administration
bender3000, 2016-10-16 12:53:52

[HELP] How to add all elements from the list with student id binding?

For the third day I can not figure out how to write a cycle for entering data from the list!
Now I can add one record to the table with student id, grade name and grade itself.
Private Sub save_marks_Click()
Dim strSQL As Variant
Dim criteriaSQL As String
criteriaSQL = " Insert Into marks(userid, finalgrade) values ​​('" & Me.student & "', '" & Me.mark & ​​"')"
For Each strSQL In criteria.Column
strSQL = " Insert Into marks(criteriaid) values ​​('" & Me.criteria & "');"
CurrentProject.Connection.Execute(strSQL)
Next strSQL
MsgBox("Added!")
End Sub

But for the loop, you need to assign each line its own score (combobox). And here is the plug. The For Each next loop could not be compiled correctly, it constantly swears at the data type, but I don’t understand how to group them. Please help!a582fff9a4d94d60b62b494cf9ea2fd2.png5a5a811c29ea48099fc6bd2642e5f325.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artyom Karetnikov, 2016-10-17
@art_karetnikov

This is what I just wrote to you about. The approach is strange.
You change or add at one time - one entry. One. Why the hell writing them all?
We catch the after_update event of the combobox with ratings. And insert/update the record. One. Don't forget to check that the Grade, Subject, Student comboboxes are filled in.
This is if you really want the code. But the same thing can be done without any code at all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question