Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Access 2007 - Cost field populated based on combo box

Posted on 2015-02-15
2
Medium Priority
?
239 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

688 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