Frame On_Click event doesn't fire on "no change"

rpadams

Registered User.
Local time
Today, 16:03
Joined
Jun 17, 2001
Messages
111
I have an invoice program that allows users to select a shipping cost option as a toggle in a frame object. When selected "On_Click", the percentage is used to calculate the shipping of the items ordered. Occasionally users will then add additional items, re-click the toggle, but nothing happens. If they click another shipping percentage (there are 3) it calculates. If they click the original percentage now,(essentially CHANGING the frame.value) the calculation occurs fine. It almost seems that the On_Click event toggle in the frame is acting like an On_Change or AfterUpdate.

I have tried the mouse-down event, but this doesn't change the percentage.

I know I could add a separate "Calculate" button after the user makes the shipping selection, but someone is bound to forget to hit it.

Any ideas on how to make the frame On_Click work if the value doesn't change in doing so?
 
When you say "toggle" are you actually talking about a toggle button? There are only two states for it: Yes and No. So, I'm not sure how you can have 3 options, unless you are using a different control and just using "toggle" as different terminology.

So, can you clarify? I tried building a form with two radio control buttons (option select) and the click event of the frame worked fine. Then I tried changing the radio control buttons to actual toggle buttons and it still picked up the change.
 
Frame is actually an OPTION group

I should have been a little clearer. I have 3 option choices (1,2,3) and a default of null. Clicking the option box is supposed to fire a routine that performs calculations. This works if it is not a prior, immediate choice. If choice "1" is selected, then other data is added elsewhere in the form, and choice "1" is reselected, the calculations are not performed. If another choice, say "2" is selected, the calculation fires as it should. If "2" is selected, then I go back and click "1" again, it fires OK. It seems I have to CHANGE the option value to make it work.
 
what code do you have in the click event of the frame?
 
This is the code

Notes: Frame95 is option group
Text19 is sum of items ordered on order subform
Text104 holds shipping cost in table
====================
Private Sub Frame95_Click()

If Me!Frame95 = 1 Then
Me!txtOrd_Shipping = [frmOrderDetailSub].[Form]![Text19] * 0.1
Me.Text104.Value = Me.txtOrd_Shipping 'put in amount
'rem 10% shipping cost
End If
If Me!Frame95 = 2 Then
Me!txtOrd_Shipping = [frmOrderDetailSub].Form![Text19] * 0.15
Me.Text104.Value = Me.txtOrd_Shipping
'rem 15%
End If

If Me!Frame95 = 3 Then 'rem dollar input
Me!txtOrd_Shipping = Nz(Me!Text104, 0)
End If

'Rem - Free shipping below

If Me.Frame95.Value = 4 Then
Me!txtOrd_Shipping = 0
End If
===============
 
Sounds more like a user interface problem than a coding problem.

Don’t know if this would be acceptable but you could use the MouseMove event to reset the Option back to Null.

It would take some playing with, and acceptance by the user to make it look good, but it is possible.

Exactly how do you want it to appear to the user?
 
Two quick questions.

1. Which version of Access are you using?
2. Is it possible for you to post your database so I can take a look (I'm more visual). Also, I can make some other suggestions for you.


I would highly suggest changing your naming of the frame and the other generically named textboxes to make it easier for someone coming in to know exactly what they are looking at. Frame95 or Text104 are not very descriptive and can help to confuse and disorient anyone outside of you (it can also confuse you a year on down the line if you aren't constantly doing development in it).
 
I would have triggered the calculation on any change in the data. This may mean adding the code to multiple events on different controls.
 
The Onclick event fires if you click the border of the frame but not if you click on a selected option.

I would also recomend adding code to affected fields, they could then call the frame code and you would be best to rewrite the code there using a Select Case statement with a trap for null incase it is called from another field before being set.

HTH

Peter
 

Users who are viewing this thread

Back
Top Bottom