Calculation code help

petercummins

Registered User.
Local time
Today, 06:08
Joined
Sep 6, 2005
Messages
52
Hi people of the Access world. Wondered if you could help me once again.

I have set up a form to calculate a number of combo boxes where the option is selected to "Y".

There is a bit of code where it is not working properly. I will post the code where I think the problem lies but if you need more help I can post part of the database if you need more info.

' New HEATING SYSEM, new KITCHEN AND BATHROOM

If Me.cboHeating = "Y" And Me.cboKitchenAndBathroom = "Y" Then

Me.txtTotal.Value = 90

End If


' New KITCHEN AND BATHROOM

If Me.cboKitchenAndBathroom = "Y" Then

Me.txtTotal.Value = 80

End If

The problem is that when I want to select Heating - "Y" KitchenAndBathroom - "Y", txtTotal is showing "80" and not "90" as its suppose to.

All the other variations of the code are working but not this one.

Any ideas?
 
Its because Access is reading straight through the code and as the "Y" is correct in part 2 it then reads the new value of 80.

You need to exit the sub and forget the 2nd part if the first part is correct. Try writing it something like this

Code:
If Me.cboHeating = "Y" And Me.cboKitchenAndBathroom = "Y" Then

Me.txtTotal.Value = 90

ElseIf Me.cboHeating = "N" And Me.cboKitchenAndBathroom = "Y" Then

Me.txtTotal.Value = 80

End If


Col
 
Col, thats is brilliant thanks. Legend
 

Users who are viewing this thread

Back
Top Bottom