Solved

Access 2007 - Cost field populated based on combo box

Posted on 2015-02-15
2
229 Views
Last Modified: 2015-02-15
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
Comment
Question by:bobrossi56
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 40611061
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
 
LVL 3

Expert Comment

by:Leo Alexander
ID: 40611063
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question