Calculating two fields from the same combo box

Jadey

New member
Local time
Today, 22:19
Joined
May 1, 2009
Messages
2
I have a form with the field, Attendees.<--user input

I have a combo box which has the description of an event, It also has the base price of the event and the attendee cost.

eg: description:Bungee Jumping
base price £450.00
attendee cost: £35.00 (set fields)

I want to calculate Attendees*attendee cost+base price.
How do i get the result of this query into a text box?
Should i rethink the combo box and use only text boxes?

Is it even possible to calculate fields from a combo box?

Can i pull the base price and attendee cost out of the combo box and have them populate fields and then query them?

if this is true how do i link a query button to a text box

I am not a complete novice when it comes to access, BUT i am out of date, The last time i used access was back in 1998, I have no idea what I'm doing with access 2007 now.

can anyone help me.
Grateful for any help in advance. =}

Jadey xx
 
You can populate other controls (textboxes) from a combo box by using something similar to:

Me.WO_CompanyName = Me.cboCustomerID.Column(1)
Me.WO_Address1 = Me.cboCustomerID.Column(2)
Me.WO_Address2 = Me.cboCustomerID.Column(3)
Me.WO_Address3 = Me.cboCustomerID.Column(4)
Me.WO_TownCity = Me.cboCustomerID.Column(5)
Me.WO_County = Me.cboCustomerID.Column(6)
Me.WO_Postcode = Me.cboCustomerID.Column(7)
Me.WO_Phone = Me.cboCustomerID.Column(8)

Me.Result.Requery

Where the Me.cboCustomerID is the combobox in question remember that the column count starts at (0) which would normally be your bound field you could use something similar in the afterupdate event of your combobox.

As for the calculation you could have a text box named result and use something like Me.Result = ([Attendee]*[Attendee cost])+[Base Cost] in the on current event of the form and requery the results box in the afterupdate event of the combo.

regards John :)
 
Last edited:
Sounds like your complicating it more than need be..........
An unbound text box with the calculation should do it.........
In the text box .... =(cboComboBox1.Column(?)*cboComboBox2.Column(?))
OR
You could also do the calculation in the query....... and reference the field from that query.
This would be better if you plan on using the calculated results in other forms, reports....so on
 
Yep Curtis is right was just throwing out ideas I use calculated fileds in queries as well which is ok as long as you don't want to keep historic data if the prices change :)
 
jsv makes a good point I skipped.... DO consider if you need this kept as historical data...... MUCH easier to adjust your tables now then to attempt it later when you realize you need to save that data!
 

Users who are viewing this thread

Back
Top Bottom