Form with fields for viewing purposes only

T

Tanya

Hi I have a form which I need the user to be able select individual students
from a drop down list, the table it is linked to is [students] and I have a
field [studentID] which I have run the following query for Row Source and it
is not working, is the problem that the form field may be edited?

SELECT DISTINCTROW Students.StudentFName & ", " & [studentLName] AS FullName
FROM Students ORDER BY Students.StudentFName & ", " & [studentLName];

My Goal:
I wish to be able to select from a dropdown box a students full name. I have
used the studentID field to run the row Source query but the following error,
hence I thought it might have something to do with the field being able to
directly edit the table [students]

**********The value you entered isn't valid for this field.**********


Any assistance/guidance in this matter would be greatly appreciated.

Kind Regards
Tanya
 
A

Allen Browne

You cannot just set the AllowEdits property of the form to No. If you do,
you won't be able to select anything in the drop-down box to find the record
you want.

Instead, set the Locked property of the text boxes to Yes. This will prevent
the user from chaning them. You leave the Locked proeprty of your unbound
combo set to No, and you can still select the record to go to.

Does your table have a primary key? Perhaps there is an autonumber field
named StudentID or similar? It sounds like the combo is bound to a Number
field, but is actually gettting text typed into it. This would explain the
"value isn't valid" message.

Here's some more info about setting up a combo to jump to a record:
Using a Combo Box to Find Records
at:
http://allenbrowne.com/ser-03.html
 
T

Tanya

Thank you for your advice Allen.

When I created the combo box using the wizard, all worked well, I think the
problem may have been with the number of columns as a property setting.

I will use your advice about setting locked property.

Kind Regards
Tanya

Allen Browne said:
You cannot just set the AllowEdits property of the form to No. If you do,
you won't be able to select anything in the drop-down box to find the record
you want.

Instead, set the Locked property of the text boxes to Yes. This will prevent
the user from chaning them. You leave the Locked proeprty of your unbound
combo set to No, and you can still select the record to go to.

Does your table have a primary key? Perhaps there is an autonumber field
named StudentID or similar? It sounds like the combo is bound to a Number
field, but is actually gettting text typed into it. This would explain the
"value isn't valid" message.

Here's some more info about setting up a combo to jump to a record:
Using a Combo Box to Find Records
at:
http://allenbrowne.com/ser-03.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Tanya said:
Hi I have a form which I need the user to be able select individual
students
from a drop down list, the table it is linked to is [students] and I have
a
field [studentID] which I have run the following query for Row Source and
it
is not working, is the problem that the form field may be edited?

SELECT DISTINCTROW Students.StudentFName & ", " & [studentLName] AS
FullName
FROM Students ORDER BY Students.StudentFName & ", " & [studentLName];

My Goal:
I wish to be able to select from a dropdown box a students full name. I
have
used the studentID field to run the row Source query but the following
error,
hence I thought it might have something to do with the field being able to
directly edit the table [students]

**********The value you entered isn't valid for this field.**********


Any assistance/guidance in this matter would be greatly appreciated.

Kind Regards
Tanya
 

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