Populate value dependent upon previous field

G

Guest

I have a table containing insurance types and the rate for each type.
On a form I have a combo to select one of the insurance types, then the next
field is for the relevant rate.
I would like the rate field to be populated automatically once the type has
been selected.
I have been trying to build code based on After Update but cannot get it to
work and I know this is a basic bit of work but it has been a long day here
(UK) and the brain is getting blunt - no doubt somebody can point me in the
right direction?
Many thanks
CW
 
J

John Vinson

I have a table containing insurance types and the rate for each type.
On a form I have a combo to select one of the insurance types, then the next
field is for the relevant rate.
I would like the rate field to be populated automatically once the type has
been selected.
I have been trying to build code based on After Update but cannot get it to
work and I know this is a basic bit of work but it has been a long day here
(UK) and the brain is getting blunt - no doubt somebody can point me in the
right direction?
Many thanks
CW

Bear in mind that I cannot see your form, have no idea what your
control names might be, nor what you've tried nor what problems you're
having... but:

Private Sub cboInsuranceType_AfterUpdate()
Me.txtRate = Me.cboInsuranceType.Column(2)
End Sub

will push the value from the third field (it's zero based) in the
combo box cboInsuranceType's row source into the textbox named
txtRate.

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