Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Value of a field based on another field

Status
Not open for further replies.

mana2

Programmer
Aug 9, 2002
116
US
Hi,

I have a table(called MedicalPlans) with two fields, enrollment and premium. In the form(called BenefitsInfo) when one of the drop down values for enrollment is selected, the value for premium needs to be filled. I created a combo box for the premium field and used the following select statement which doesn't work:

SELECT MedicalPlans.[Premium] FROM MedicalPlans WHERE ((([MedicalPlans].[Enrollment])=[Forms]![BenefitsInfo]![Enrollment]));

Also do I need to put code behind the form?

Thanks
 
If I understand you correctly (you want to palce the premium in a text box bound to the premium field), you need to use code in the after update event of the combo box. Assuming the Premium field is bound to a text box "txtPremium" and the combo box contains columns of both the Enrollment and Premium fields from MedicalPlans.
Code:
Me.txtPremium = Me.Enrollment.Column(1)

Duane
MS Access MVP
[green]Ask a great question, get a great answer.[/green]
[red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
[blue]Ask me about my grandson, get a grand answer.[/blue]
 
Thank you so much, that worked. I started looking at the After Update event but I wasn't quite getting it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top