Change a value when closing a Form

R

Ricoy-Chicago

Using Access XP.

I am creating a student survey. A form, [TeacherNSubjects], shows all the
student's teachers. They click on a teacher's name and the form,
[TeacherSurvey], is displayed, a [Return] button takes the student back to
[TeacherNSubjects] so they can select a different teacher. No problems here
at all. The problem is that when the student clicks on the [Return] button, I
want the "Yes/No" field [Did Survey] = true. In hte code of the [Return]
button, I typed: Tables![Survey Data]![Did Survey]=True but then I got the
error: "Object required" when I run the coding

Do I need to open the table so it can be updated?
 
B

Beetle

On your TeacherSurvey form, add a checkbox control that is bound to the
DidSurvey field (make it hidden if you don't want your users to see it). Then
in the click event of your Return button, put code like;

Me![chkDidSurvey] = True
 
R

Ricoy-Chicago

I tried that but then ALL teachers get a check... the [did survey] field is
in the table that tracks the answers. other fields in this table are:
[StudentID], [SubjectCode], [TeacherCode], [DidSurvey], [answer1], [answer2],
etc. So the [DidSurvey]=yes means that the student did the survey for the
[teachercode], [subjectcode] fields.
I want the value in the table to change to Yes, how can I refer to a table
from form coding?

Thanks for your hint..

Beetle said:
On your TeacherSurvey form, add a checkbox control that is bound to the
DidSurvey field (make it hidden if you don't want your users to see it). Then
in the click event of your Return button, put code like;

Me![chkDidSurvey] = True
--
_________

Sean Bailey


Ricoy-Chicago said:
Using Access XP.

I am creating a student survey. A form, [TeacherNSubjects], shows all the
student's teachers. They click on a teacher's name and the form,
[TeacherSurvey], is displayed, a [Return] button takes the student back to
[TeacherNSubjects] so they can select a different teacher. No problems here
at all. The problem is that when the student clicks on the [Return] button, I
want the "Yes/No" field [Did Survey] = true. In hte code of the [Return]
button, I typed: Tables![Survey Data]![Did Survey]=True but then I got the
error: "Object required" when I run the coding

Do I need to open the table so it can be updated?
 
B

Beetle

What is the recordsource of the TeacherSurvey form? Is it the table that
has the DidSurvey field, or is that field in some other table?
--
_________

Sean Bailey


Ricoy-Chicago said:
I tried that but then ALL teachers get a check... the [did survey] field is
in the table that tracks the answers. other fields in this table are:
[StudentID], [SubjectCode], [TeacherCode], [DidSurvey], [answer1], [answer2],
etc. So the [DidSurvey]=yes means that the student did the survey for the
[teachercode], [subjectcode] fields.
I want the value in the table to change to Yes, how can I refer to a table
from form coding?

Thanks for your hint..

Beetle said:
On your TeacherSurvey form, add a checkbox control that is bound to the
DidSurvey field (make it hidden if you don't want your users to see it). Then
in the click event of your Return button, put code like;

Me![chkDidSurvey] = True
--
_________

Sean Bailey


Ricoy-Chicago said:
Using Access XP.

I am creating a student survey. A form, [TeacherNSubjects], shows all the
student's teachers. They click on a teacher's name and the form,
[TeacherSurvey], is displayed, a [Return] button takes the student back to
[TeacherNSubjects] so they can select a different teacher. No problems here
at all. The problem is that when the student clicks on the [Return] button, I
want the "Yes/No" field [Did Survey] = true. In hte code of the [Return]
button, I typed: Tables![Survey Data]![Did Survey]=True but then I got the
error: "Object required" when I run the coding

Do I need to open the table so it can be updated?
 
R

Ricoy-Chicago

It is a form containing a subform. The main form has the [Student id], [class
code], [teacher code], the subform has the questions. The subform is based on
the table taht has the [didSurvey] field

Beetle said:
What is the recordsource of the TeacherSurvey form? Is it the table that
has the DidSurvey field, or is that field in some other table?
--
_________

Sean Bailey


Ricoy-Chicago said:
I tried that but then ALL teachers get a check... the [did survey] field is
in the table that tracks the answers. other fields in this table are:
[StudentID], [SubjectCode], [TeacherCode], [DidSurvey], [answer1], [answer2],
etc. So the [DidSurvey]=yes means that the student did the survey for the
[teachercode], [subjectcode] fields.
I want the value in the table to change to Yes, how can I refer to a table
from form coding?

Thanks for your hint..

Beetle said:
On your TeacherSurvey form, add a checkbox control that is bound to the
DidSurvey field (make it hidden if you don't want your users to see it). Then
in the click event of your Return button, put code like;

Me![chkDidSurvey] = True
--
_________

Sean Bailey


:

Using Access XP.

I am creating a student survey. A form, [TeacherNSubjects], shows all the
student's teachers. They click on a teacher's name and the form,
[TeacherSurvey], is displayed, a [Return] button takes the student back to
[TeacherNSubjects] so they can select a different teacher. No problems here
at all. The problem is that when the student clicks on the [Return] button, I
want the "Yes/No" field [Did Survey] = true. In hte code of the [Return]
button, I typed: Tables![Survey Data]![Did Survey]=True but then I got the
error: "Object required" when I run the coding

Do I need to open the table so it can be updated?
 
B

Beetle

Based on what I know from your posts so far, it sounds like you might
have the DidSurvey field in the wrong table. It seems like that would be
in the table that holds the main info about the survey, not the table of
survey questions.
--
_________

Sean Bailey


Ricoy-Chicago said:
It is a form containing a subform. The main form has the [Student id], [class
code], [teacher code], the subform has the questions. The subform is based on
the table taht has the [didSurvey] field

Beetle said:
What is the recordsource of the TeacherSurvey form? Is it the table that
has the DidSurvey field, or is that field in some other table?
--
_________

Sean Bailey


Ricoy-Chicago said:
I tried that but then ALL teachers get a check... the [did survey] field is
in the table that tracks the answers. other fields in this table are:
[StudentID], [SubjectCode], [TeacherCode], [DidSurvey], [answer1], [answer2],
etc. So the [DidSurvey]=yes means that the student did the survey for the
[teachercode], [subjectcode] fields.
I want the value in the table to change to Yes, how can I refer to a table
from form coding?

Thanks for your hint..

:

On your TeacherSurvey form, add a checkbox control that is bound to the
DidSurvey field (make it hidden if you don't want your users to see it). Then
in the click event of your Return button, put code like;

Me![chkDidSurvey] = True
--
_________

Sean Bailey


:

Using Access XP.

I am creating a student survey. A form, [TeacherNSubjects], shows all the
student's teachers. They click on a teacher's name and the form,
[TeacherSurvey], is displayed, a [Return] button takes the student back to
[TeacherNSubjects] so they can select a different teacher. No problems here
at all. The problem is that when the student clicks on the [Return] button, I
want the "Yes/No" field [Did Survey] = true. In hte code of the [Return]
button, I typed: Tables![Survey Data]![Did Survey]=True but then I got the
error: "Object required" when I run the coding

Do I need to open the table so it can be updated?
 
R

Ricoy-Chicago

If I put the [DidSurvey] in the instructors table then when a student answers
the survey it will indicate that it was done by ALL the students. That is why
the [DidSurvey] is part of the questions table, that way the student cannot
do two surveys for the same teacher.

Beetle said:
Based on what I know from your posts so far, it sounds like you might
have the DidSurvey field in the wrong table. It seems like that would be
in the table that holds the main info about the survey, not the table of
survey questions.
--
_________

Sean Bailey


Ricoy-Chicago said:
It is a form containing a subform. The main form has the [Student id], [class
code], [teacher code], the subform has the questions. The subform is based on
the table taht has the [didSurvey] field

Beetle said:
What is the recordsource of the TeacherSurvey form? Is it the table that
has the DidSurvey field, or is that field in some other table?
--
_________

Sean Bailey


:

I tried that but then ALL teachers get a check... the [did survey] field is
in the table that tracks the answers. other fields in this table are:
[StudentID], [SubjectCode], [TeacherCode], [DidSurvey], [answer1], [answer2],
etc. So the [DidSurvey]=yes means that the student did the survey for the
[teachercode], [subjectcode] fields.
I want the value in the table to change to Yes, how can I refer to a table
from form coding?

Thanks for your hint..

:

On your TeacherSurvey form, add a checkbox control that is bound to the
DidSurvey field (make it hidden if you don't want your users to see it). Then
in the click event of your Return button, put code like;

Me![chkDidSurvey] = True
--
_________

Sean Bailey


:

Using Access XP.

I am creating a student survey. A form, [TeacherNSubjects], shows all the
student's teachers. They click on a teacher's name and the form,
[TeacherSurvey], is displayed, a [Return] button takes the student back to
[TeacherNSubjects] so they can select a different teacher. No problems here
at all. The problem is that when the student clicks on the [Return] button, I
want the "Yes/No" field [Did Survey] = true. In hte code of the [Return]
button, I typed: Tables![Survey Data]![Did Survey]=True but then I got the
error: "Object required" when I run the coding

Do I need to open the table so it can be updated?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top