combo list problems

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form control with a combo box which is called Exam Name which
relates back to a table called tblCourseExams ExamName field through a query,
in the properties row source I have the following SQL

SELECT tblExams.ExamName, tblExams.InActive FROM tblExams WHERE
(((tblExams.InActive)=No));

When I select a name from the list I receive this message

The Microsoft jet engine cannot find a record in the table 'tblExams' with
key matching field(s) 'ExamName'.

The ExamName I select is in the tblExams table.

I would appreciate some HELP please

Rodney
 
Hi Rodney,

Your posted SQL is looking for a table called "tblExams", but your problem
statement refers to a table called "tblCourseExams" Which is correct? If
your problem statement lists the correct table name, change your SQL to
refer to that table. If your SQL is correct, verify that the field name is
actually "ExamNames", and not something similar, such as "fldExamNames".
 
Susan thanks for the reply
I have a table called tblExams which hass all active and inactive exams and
details in it.
From the form control is to tblCourseExams.ExamName which is a combo box.
The combo box list I want to come from the table tblExams if the Exam is
active so as to create an active exam occurence in the table tblCourseExams
which consists of the ExamName along with other info required in the record
set.
 
Hmmm, I'm a bit unclear on your setup, but I *think* you are saying that the
form's Record Source is tblCourseExams and you want the combobox to list
items in tblExams? If so, you need to set the RowSourceType property to
Table/Query and the RowSource property of the combobox to tblExams, not the
ControlSource property. If you want to populate the field ExamName in
tblCourseExams with the choice of the user, you can set the ControlSource
property to ExamName (which should be available in the dropdown list of the
property itself).

Susan V
 
susan thanks for your help.
I have a table called tblExams which has some fields named ExamName,
Inactive which is Yes/No and some others. All I want to do is use the
ExamNames in this table in the combo box list on a form so users do not need
to type in the names on the form. But on the form when I select one of the
ExamNames from the list and then exit the form I receive this error.
The Microsoft jet engine cannot find a record in the table 'tblExams' with
key matching field(s) 'ExamName'.

Rodney
 
Where are you referencing the table tblExams? Are you using a query or the
table directly? Perhaps if you could answer the following it would be
clearer to me, to be able to help:

What is the Recordsource of the form?

The Control Source of the combobox? (If this control is bound, this MUST be
a field included in the Form's Recordsource)

The RowSource of the combobox?

The RowSourceType of the combobox?


Also, from your description, it sounds as though you would want to filter
the available items in the list by whether the exam is active - in which
case you should be using a query, such as "SELECT tblExams.ExamName FROM
tblExams WHERE Inactive = False" You can save this query and reference it in
the RowSource property rather than the table.

SusanV
 
Back
Top