By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,301 Members | 3,575 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,301 IT Pros & Developers. It's quick & easy.

Calculated Control

P: 11
I have two controls to show table field "Seconds" and calculated field "Hours". Is there a way to show the right "Hours" when "Seconds" got changed on form?
Jul 12 '07 #1
Share this Question
Share on Google+
12 Replies


puppydogbuddy
Expert 100+
P: 1,923
I have two controls to show table field "Seconds" and calculated field "Hours". Is there a way to show the right "Hours" when "Seconds" got changed on form?
Yes, see "Calculating Elapsed Time" in the following link. It contains a function that calculates and displays elapsed time in hours, minutes, and seconds. You should be able to call the function from the form and extract the components (e.g. hours, seconds) as needed.

http://office.microsoft.com/en-us/ac...102181033.aspx
Jul 12 '07 #2

P: 11
Thank you so much for your help. I learn something new.
The sort button is grayed for the calculated control. Is there a way to sort it?
Jul 13 '07 #3

puppydogbuddy
Expert 100+
P: 1,923
Thank you so much for your help. I learn something new.
The sort button is grayed for the calculated control. Is there a way to sort it?
That means the sort button is disabled. What are you trying to sort?
Jul 13 '07 #4

P: 11
I have a calculated % value which is (base$ - final$)/base$ that I like to sort. Because the sort button grayed out for the calculated control, I like to know if there is a way to sort it.
Jul 13 '07 #5

puppydogbuddy
Expert 100+
P: 1,923
I have a calculated % value which is (base$ - final$)/base$ that I like to sort. Because the sort button grayed out for the calculated control, I like to know if there is a way to sort it.
Try invoking the property sheet for the Form that the calculated control is on; go to the OrderBy property and enter the name of the calculated control that you want the records ordered.
Jul 13 '07 #6

P: 11
I got "Can not find column (control name)". I suspect it only can sort the fields from table. I use Access 2003.
Jul 13 '07 #7

puppydogbuddy
Expert 100+
P: 1,923
I got "Can not find column (control name)". I suspect it only can sort the fields from table.
You may be right (I will check it out) ......
In the meantime, try to reference it like this in the orderby property (assumes calculated control is on a form, not a subform)::

Forms!YourForm!ControlName

or Try it using VBA:

Private Sub Form_Open()

Me.OrderBy = "Forms!YourForm!ControlName"
Me.OrderByOn = True

End Sub
Jul 13 '07 #8

P: 11
Nothing happens for both methods. May be the only way is to store the % value in table.
Jul 13 '07 #9

puppydogbuddy
Expert 100+
P: 1,923
Nothing happens for both methods. May be the only way is to store the % value in table.
That is not the only way...you can compute the % value in the query that is the record source for your form. You would then be able to sort on this column because it would appear on your field list for the form and you would use it as the control source for your textbox.
Jul 14 '07 #10

P: 11
But this way will go back to the top of my post. How do you show the right % value when final$ is changed on the form. I am trying to figure out a way to do the following with one solution.

1. Be able to sort the calculated value using sort button.
2. Be able to show the right calculated value when other data changed.

What I found is, control source from query will solve (1) but not (2) because calculated value is not updateable. Expression on control source will solve (2) but not (1) because expression is not sortable.

Let me know if I am wrong.
Jul 16 '07 #11

puppydogbuddy
Expert 100+
P: 1,923
But this way will go back to the top of my post. How do you show the right % value when final$ is changed on the form. I am trying to figure out a way to do the following with one solution.

1. Be able to sort the calculated value using sort button.
2. Be able to show the right calculated value when other data changed.

What I found is, control source from query will solve (1) but not (2) because calculated value is not updateable. Expression on control source will solve (2) but not (1) because expression is not sortable.

Let me know if I am wrong.
I believe calculated value is updateable via code as follows:
Try: Forms!YourForm!YourControl.Recalc
If that does not work, try: Me.Recalc
Jul 16 '07 #12

puppydogbuddy
Expert 100+
P: 1,923
I believe calculated value is updateable via code as follows:
Try: Forms!YourForm!YourControl.Recalc
If that does not work, try: Me.Recalc

Also, AFAIK an expression is sortable, but apparently there is a bug with percent format...see this link:

http://allenbrowne.com/Access2007.html#Solved
Jul 16 '07 #13

Post your reply

Sign in to post your reply or Sign up for a free account.