Filling textboxes using the value from a combobox

  • Thread starter Thread starter spnz via AccessMonster.com
  • Start date Start date
S

spnz via AccessMonster.com

Hi there

Sorry if this is a really stupid question but I am completly new to access
and need some help.

I have a table that contains about 500 records. I would like to be able to
search the table using a combobox on a form as its a pain searching the
table.

The table contains about 20 fields. I have set up a form to contains all
the fields that I want to display (I dont need to see all 20 fields).


I was hoping to have 2 columns in the combobox 1.Name 2.Department. I know
how to setup the combobox and get it to display the search criteria but how
do I once I have clicked on the record I want,transfer all its other
information to the empty textboxes.

If anyone can point in the right direction of a little help I would be most
grateful.

Thanks
 
Hi there

Sorry if this is a really stupid question but I am completly new to access
and need some help.

I have a table that contains about 500 records. I would like to be able to
search the table using a combobox on a form as its a pain searching the
table.

The table contains about 20 fields. I have set up a form to contains all
the fields that I want to display (I dont need to see all 20 fields).

I was hoping to have 2 columns in the combobox 1.Name 2.Department. I know
how to setup the combobox and get it to display the search criteria but how
do I once I have clicked on the record I want,transfer all its other
information to the empty textboxes.

If anyone can point in the right direction of a little help I would be most
grateful.

Thanks

1) Add an unbound combo box to the Form Header. Use the
Combo Wizard and select the 3rd option on the first page of questions,
something like "Find a record ...".

In the Combo Box, use a Prime Key field, LastName field, FirstName
field and the Department field in the combo box. You would hide
the Prime Key field, and display the others. You can then select the
correct individual, and Access will locate the correct record by using
the Prime Key field.

2) Do you really have a field named "Name"?

Name is a reserved Access/VBA/Jet word and should not be used as a
field name.
See the Microsoft KnowledgeBase article for your version of Access:

109312 'Reserved Words in Microsoft Access' for Access 97
209187 'ACC2000: Reserved Words in Microsoft Access'
286335 'ACC2002: Reserved Words in Microsoft Access'
321266 'ACC2002: Microsoft Jet 4.0 Reserved Words'
 
Hi,
The combo wizard will do this for you. Just make sure the 'wand' in the toolbox is depressed and then
add a combo to your form. It will then give you a choice to find a record based on the combo value.
 
I was hoping to have 2 columns in the combobox 1.Name 2.Department. I know
how to setup the combobox and get it to display the search criteria but how
do I once I have clicked on the record I want,transfer all its other
information to the empty textboxes.

If anyone can point in the right direction of a little help I would be most
grateful.

Well... you don't really want to *transfer* any information. Instead,
consider the Form as a movable window: you want to move it to the
record of interest in the table.

The simplest way to do this is to include the unique Primary Key of
the table in the combo's row source - the EmployeeID I'd guess. If
your table doesn't have a Primary Key then... well, your table MUST
contain a Primary Key or it's not a real table.

The Combo Box wizard on the Toolbox has an option to do this. Create
the Combo Box with the magic wand icon selected on the toolbox, and
take the option "Use this combo box to find a record in the form". If
your wizard doesn't provide this option, or you can't find it, post
back - it's not that hard to do manually.

John W. Vinson[MVP]
 
Great thanks alot guys!!!!

Sorry I didn't have a field named "Name" I joined the fields Surname &
Forename to create name.


Thanks everyone for your help!!!
 
Back
Top