Is there a way to populate one field, based on data in another?

T

tg7

In my form, I would like the table field to populate based on the selection
from a combobox in another field. I need to store the numerical value of the
combobox field, but need to have the text as well for reports. The reason I
want to auto-populate the field, is for user convenience, but I don't want to
use a query because sometimes the user may need to over-ride the auto value.

The table fields are:
RiskTotal (combobox)
RiskLevel

If RiskTotal=6-8, then I would like RiskLevel to populate High
If RiskTotal=3-5, then I would like RiskLevel to populate Medium
If RiskTotal=0-2, then I would like RiskLevel to populate Low

Then I would like to use conditional formatting to color code the risk level.

I don't have any programming experience, any help would be appreciated
 
A

AccessVandal via AccessMonster.com

Hi,

In your update event of the combo, for example

Select Case Me.RiskTotal
Case 6 To 8
RiskLevel = "High"
Case 3 To 5
RiskLevel = "Medium"
Case 0 To 2
RiskLevel = "Low"
End Select

In the Current event of your form, assume the back color of textbox.

Something like,

Select Case Me.RiskLevel
Case "High"
Me.RiskLevel.BackColor = vbRed
Case "Medium"
Me.RiskLevel.BackColor = vbBlue
Case "Low"
Me.RiskLevel.BackColor = vbGreen
End Select

On how to create a combobox, try Allen Browne's site.
http://allenbrowne.com/tips.html
 

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