SYNCHRONIZE VALUES IN COMBO BOX AND OTHER FIELDS

G

Guest

Thanks for your help in advance

I have a table called Tblpersonal details- this has 4 fields- IDno, Surname,
Fname and Dtae of Birth- IDno is primary key for this table. A form is based
on this table- IDno field is a combobox.

table has following entries ( all names and data are imaginary!)

1 smith john 1/1/1903
2 kirk chris 1/1/1931
3 sell tom 1/1/1913
4 buy me 1/1/1933

the form has 4 fields- IDno ( combo box ) other fields on form are- Surname,
Fname, DOB-

First time I enter the data, i obviously have to enter all the details .
with combobox showing value 1, other fields are showing corrosponding values
in other fields.
when i choose the value 2 in combo box - the values in other fileds
displayed donot change..as if they are not attached to respective primary
field value.. in other words.. if i choose 2 in combo box- i want to see
values kirk, chris, 1/1/1931 and so on.. is this possible?
many thanks once again
 
G

Guest

Put an unbound combo box on you form called cboIDno (or whatever)
The row souce of the combo box should be a query that shows IDno from
Tblpersonal details. Then in the After Update event of the combo box (in the
combo box properties window go to the Events tab, select After Update, click
the elipse and choose "Code Builder") put the following;

Me.IDno = Me.cboIDno
 
J

John W. Vinson

Thanks for your help in advance

I have a table called Tblpersonal details- this has 4 fields- IDno, Surname,
Fname and Dtae of Birth- IDno is primary key for this table. A form is based
on this table- IDno field is a combobox.

table has following entries ( all names and data are imaginary!)

1 smith john 1/1/1903
2 kirk chris 1/1/1931
3 sell tom 1/1/1913
4 buy me 1/1/1933

the form has 4 fields- IDno ( combo box ) other fields on form are- Surname,
Fname, DOB-

First time I enter the data, i obviously have to enter all the details .
with combobox showing value 1, other fields are showing corrosponding values
in other fields.
when i choose the value 2 in combo box - the values in other fileds
displayed donot change..as if they are not attached to respective primary
field value.. in other words.. if i choose 2 in combo box- i want to see
values kirk, chris, 1/1/1931 and so on.. is this possible?
many thanks once again

This combo box must be *UNBOUND* - if its Control Source is the ID field, all
you're doing is overwriting the ID in the current record with the ID of the
selected one!

Use the Toolbox Combo Box Wizard and choose the option "use this combo to find
a record". This will create an unbound combo with a bit of VBA code which -
instead of overwriting data - navigates to the desired record. If the wizard
is uncooperateive post back with the fieldnames from your table; it's pretty
easy to write the code.

John W. Vinson [MVP]
 

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