Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help w/ drop down boxes auto filling other cells

Status
Not open for further replies.

schreima

Technical User
Apr 17, 2009
7
US
I am trying to put together a database for an upcoming conference. I have a drop down menu called "registration type" The options are "OHSU CRNA";"AANA Member";"Non-Member";"SRNA". When one of these is chosen, I'd like another field called "price" to auto fill with a specific dollar amount associated with each choice from the drop down menu. Any help would be greatly appreciated. Thank you. - Matt
 
First, I would make sure I have a table of registration types with the prices. Use this as the Row Source of your combo box like:
Code:
SELECT RegistrationType, Price
FROM tblRegistrationTypes
ORDER BY RegistrationType
You can set these properties of the combo box:
Name: cboRegistrationType
Column Count: 2
Column Widths: 1,0
Bound Column: 1

Then add code to the After Update event of the combo box
Code:
If Not IsNull(Me.txtPrice) Then
    Me.txtPrice = Me.cboRegistrationType.Column(1) 
  Else
    Me.txtPrice = Null
End If

Duane
Hook'D on Access
MS Access MVP
 

Code:
If Not IsNull(Me.txtPrice) Then
    Me.txtPrice = Me.cboRegistrationType.Column(1)
  Else
    Me.txtPrice = Null
End If

I keep going over this and I can't figure out what you're trying to do here, Duane.

If Me.txtPrice already has data in it, you want to replace it, but if it's empty, you want it to remain empty? WHat am I missing here?

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Good catch Missinglinaq. The logic was checking the wrong control for Null.

Code:
If Not IsNull(Me.cboRegistrationType) Then
    Me.txtPrice = Me.cboRegistrationType.Column(1)
   Else
    Me.txtPrice = Null
End If

Duane
Hook'D on Access
MS Access MVP
 

;0)>

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top