Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 241
  • Last Modified:

Access 2007 - Cost field populated based on combo box

Access Novice....I have a simple form/database. I have a combo box [VEHICLE] with 2 possible values CAR or TRUCK and these are simply typed into the ROW SOURCE, no table lookup. I have a text field [COST], I want this field to auto populate based on the combo box choice. For example IF VEHICLE = CAR let COST = $45.00, IF VEHICLE = TRUCK let COST = $150.00. Noting complicated, I've read I can do this if I create a table with 2 columns and do a lookup, etc but I am hoping since I just have 2 possible choices I could do it a lot easier.
thx experts...Bob R
0
bobrossi56
Asked:
bobrossi56
1 Solution
 
Rey Obrero (Capricorn1)Commented:
use the afterupdate event of the combo box

private sub vehicle_afterupdate()

select case me.vehicle
    case "Car"
   me.cost="$45.00"
    case "Truck"
   me.cost="$150.00"

    case else
end select

end sub
0
 
Leo AlexanderCommented:
You could go to the on after update property of the combo box and do a case statement:

Select Case [combo]

Case 1

me.txtCost = "$45.00"

Case 2

me.txtCost = $150.00

End Select
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now