Solved

Access 2007 - Cost field populated based on combo box

Posted on 2015-02-15
2
226 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

785 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