Search Field

slide

Registered User.
Local time
Yesterday, 18:02
Joined
Apr 4, 2008
Messages
24
I have a form with basically all the fields from a table. I want the primary key field to act as solely a search for the table and not allow them to edit that field at all. how can I do this? If it could be a drop down box to list the entries but also so they can manually type it in (with auto complete???) and it would load it
 
If the PK is an Autonumber key which would be suitable then Access will not allow it to be edited.
 
It is not an Autonumber. When I first added the field to the form it was a simple text box showing the current records value, i changed it to a Combo box and in the data properties i changed the Row Source Type to Table/Query and make a query int he Row Source to select all the rows value. But when you click on an entry in the combo box it changes the value of the current record instead of jumping to the new one
 
can you post a copy of your db so we can see what is going on?
 
I don't think I'm allowed to, I'll try to make an example db though
 
Two possible approaches.
1) If you have a relatively small number of fields, base your combo on a query that returns all of the fields you want in the form. Make the column width zero for every column except your PK. Add text boxes to your form for each feild and set the control source to be the relevant column number from the combo.
2) For a larger number of fields, base the combo on a query that returns the PK only. Create a second query that returns the other fields that you want on the form and bind the form controls to that query. Use the value in the combo box as a criterion for the query ans use the After Update event of the combo to refresh the form when the selected PK changes.
 
Here is an example db. If you open the ExampleTable Form, you can select a "Name" from the drop down list but it only changes the current entry, what I want is for it to GO to that entry
 

Attachments

What was it in my explanation that you didn't understand?
 

Users who are viewing this thread

Back
Top Bottom