B
bjh29
Greetings! Thanks in advance for any help. I have been teaching myself
access as the programmer we hired for our non-profit group went AWOL with an
incomplete project.
I have a form in which I have several unbound combo boxes which I would like
a user to click a button to insert into a table. I have a start on the code,
but it is not working even with a single entry and I need up to four entries
per click of button.
Let me explain what is happening. We have a home school group that meets
once a week for classes. This database is used to register students for
classes. Students can chooses between one to four classes each. My form
(actually it is a subform) has the LMHSCID, sessionID (semester), Student
Name, and 10 am, 11 am, 1 pm and 2 pm class choices. These options are all
selected by user through unbound combo boxes based on parameters (such as
time of class for the class choices).
I would like my button to insert into the CO-OPStudentReg table the
following info: LMHSCID (family they are in), sessionID (semester), Student
Name, ClassChoice (if not null). The table has an auto number primary field.
If a student chooses four classes they would have four entries. The only
difference between the entries would be the different classes. The other
info (LMHSCID, sessionID, Student Name) would be identical and come from the
form.
So far I have tried to code entering in only one class time (10 am) to see
if I could get it to work before I tried to add in the possible four entries.
Here is my code:
Option Compare Database
Private Sub cmdEnter_Click()
Dim strSQLEnterStudent As String
strSQLEnterStudent = "INSERT INTO CO-OPStudentReg ( LMHSCID,
sessionID,Student_Name,ClassChoice)" &_ "VALUES(" & Me.LMHSCID.Value & ", " &
Me.sessionID.Value & ", " & Me.Student_Name.Value & "," &
Me.ClassChoice10.Value & ")"
DoCmd.RunSQL strSQLAddComment
End Sub
Thanks again!
access as the programmer we hired for our non-profit group went AWOL with an
incomplete project.
I have a form in which I have several unbound combo boxes which I would like
a user to click a button to insert into a table. I have a start on the code,
but it is not working even with a single entry and I need up to four entries
per click of button.
Let me explain what is happening. We have a home school group that meets
once a week for classes. This database is used to register students for
classes. Students can chooses between one to four classes each. My form
(actually it is a subform) has the LMHSCID, sessionID (semester), Student
Name, and 10 am, 11 am, 1 pm and 2 pm class choices. These options are all
selected by user through unbound combo boxes based on parameters (such as
time of class for the class choices).
I would like my button to insert into the CO-OPStudentReg table the
following info: LMHSCID (family they are in), sessionID (semester), Student
Name, ClassChoice (if not null). The table has an auto number primary field.
If a student chooses four classes they would have four entries. The only
difference between the entries would be the different classes. The other
info (LMHSCID, sessionID, Student Name) would be identical and come from the
form.
So far I have tried to code entering in only one class time (10 am) to see
if I could get it to work before I tried to add in the possible four entries.
Here is my code:
Option Compare Database
Private Sub cmdEnter_Click()
Dim strSQLEnterStudent As String
strSQLEnterStudent = "INSERT INTO CO-OPStudentReg ( LMHSCID,
sessionID,Student_Name,ClassChoice)" &_ "VALUES(" & Me.LMHSCID.Value & ", " &
Me.sessionID.Value & ", " & Me.Student_Name.Value & "," &
Me.ClassChoice10.Value & ")"
DoCmd.RunSQL strSQLAddComment
End Sub
Thanks again!