C
CLU73
Good morning and thanks to all who answer questions on this board. It is
very helpful. My question is this.
I have a database I am trying to create in which I am trying to populate
values in a table based on a selection in a form. I have a table with the
following columns; SessionID, CamperID, WeekNo, Day. I would like to have my
form setup so that it will call the CamperID and all I have to do is select a
check box representing a day of the week and it will insert into the Session
table a WeekNo and Day that I tell it to.
So for example, in my form, I would have the camper ID which is already
pulled for me in the form and "06/20" as the label and it would be a check
box. Once this check box is selected, I would want an insert statement to
insert the values of "1" in the WeekNo column and "1" in the Day column of my
Session table. The next check box would be "06/21" and upon it's selection,
I would want to insert the values of "1" in the WeekNo column and "2" in the
Day column, etc. Upon the checking of each box, this would insert a new row
for whatever camper I was on at that time and whatever values I specify.
My problem is that I am trying to use the "On Click" function and add the
code:
Private Sub Check6_Click()
INSERT INTO SESSION (WeekNo,Session)
VALUES (1,1)
End Sub
When I try to run this, I get an error highlighting "SESSION" and stating,
"Compile Error: Expected end of statement."
I am pretty sure I am not doing this right and am wondering if anyone has
any suggestions. Can anyone help with this? I have looked at the insert
statement with no luck.
Thanks in advance,
clu73
very helpful. My question is this.
I have a database I am trying to create in which I am trying to populate
values in a table based on a selection in a form. I have a table with the
following columns; SessionID, CamperID, WeekNo, Day. I would like to have my
form setup so that it will call the CamperID and all I have to do is select a
check box representing a day of the week and it will insert into the Session
table a WeekNo and Day that I tell it to.
So for example, in my form, I would have the camper ID which is already
pulled for me in the form and "06/20" as the label and it would be a check
box. Once this check box is selected, I would want an insert statement to
insert the values of "1" in the WeekNo column and "1" in the Day column of my
Session table. The next check box would be "06/21" and upon it's selection,
I would want to insert the values of "1" in the WeekNo column and "2" in the
Day column, etc. Upon the checking of each box, this would insert a new row
for whatever camper I was on at that time and whatever values I specify.
My problem is that I am trying to use the "On Click" function and add the
code:
Private Sub Check6_Click()
INSERT INTO SESSION (WeekNo,Session)
VALUES (1,1)
End Sub
When I try to run this, I get an error highlighting "SESSION" and stating,
"Compile Error: Expected end of statement."
I am pretty sure I am not doing this right and am wondering if anyone has
any suggestions. Can anyone help with this? I have looked at the insert
statement with no luck.
Thanks in advance,
clu73