A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Formula Help in a calculated text field



 
 
Thread Tools Display Modes
  #1  
Old April 18th, 2008, 04:11 PM posted to microsoft.public.access.forms
Lori2836 via AccessMonster.com
external usenet poster
 
Posts: 44
Default Formula Help in a calculated text field

Good morning. I'm trying to figure out how to write a formula for a
calculated text field called Cost:


If Hrs is blank, allow a manual entry, otherwise if Date Initiated is
#4/1/2007#, then Hrs*94.45/1000 else Hrs*99.55/1000

and since I'm not too good at this stuff, I wonder if someone could help?

Thanks!
Lori

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200804/1

  #2  
Old April 18th, 2008, 07:06 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Formula Help in a calculated text field

Since you want to allow manual entry in the text box, you can't use the
control source property because this is, I think, a bound control. So I
think the best thing to do would be to use the form's Current event to
populate the control based on whether Hrs has a value.

If Not IsNull(Me.Hrs) Then
If Me.Date #4/1/2007# Then
Me.CalcControl = Hrs*94.45/1000
Else
Me.CalcControl = Hrs*99.55/1000
End If
End IF

Also, change the name of the control to something other than Date. Date is
a reserved word and using it as a name can cause problems.
And, forms don't have fields. They have controls. Only tables and queries
have fields.
--
Dave Hargis, Microsoft Access MVP


"Lori2836 via AccessMonster.com" wrote:

Good morning. I'm trying to figure out how to write a formula for a
calculated text field called Cost:


If Hrs is blank, allow a manual entry, otherwise if Date Initiated is
#4/1/2007#, then Hrs*94.45/1000 else Hrs*99.55/1000

and since I'm not too good at this stuff, I wonder if someone could help?

Thanks!
Lori

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200804/1


  #3  
Old April 18th, 2008, 08:08 PM posted to microsoft.public.access.forms
Lori2836 via AccessMonster.com
external usenet poster
 
Posts: 44
Default Formula Help in a calculated text field

Thanks Klatuu! I appreciate your help. If it doesn't work for some reason,
I'll let you know. Have a great weekend.

Lori



Klatuu wrote:
Since you want to allow manual entry in the text box, you can't use the
control source property because this is, I think, a bound control. So I
think the best thing to do would be to use the form's Current event to
populate the control based on whether Hrs has a value.

If Not IsNull(Me.Hrs) Then
If Me.Date #4/1/2007# Then
Me.CalcControl = Hrs*94.45/1000
Else
Me.CalcControl = Hrs*99.55/1000
End If
End IF

Also, change the name of the control to something other than Date. Date is
a reserved word and using it as a name can cause problems.
And, forms don't have fields. They have controls. Only tables and queries
have fields.
Good morning. I'm trying to figure out how to write a formula for a
calculated text field called Cost:

[quoted text clipped - 6 lines]
Thanks!
Lori


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200804/1

  #4  
Old April 18th, 2008, 08:17 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Formula Help in a calculated text field

Please do,
You, too.
Mine starts in 15 minutes. Be Back Monday
--
Dave Hargis, Microsoft Access MVP


"Lori2836 via AccessMonster.com" wrote:

Thanks Klatuu! I appreciate your help. If it doesn't work for some reason,
I'll let you know. Have a great weekend.

Lori



Klatuu wrote:
Since you want to allow manual entry in the text box, you can't use the
control source property because this is, I think, a bound control. So I
think the best thing to do would be to use the form's Current event to
populate the control based on whether Hrs has a value.

If Not IsNull(Me.Hrs) Then
If Me.Date #4/1/2007# Then
Me.CalcControl = Hrs*94.45/1000
Else
Me.CalcControl = Hrs*99.55/1000
End If
End IF

Also, change the name of the control to something other than Date. Date is
a reserved word and using it as a name can cause problems.
And, forms don't have fields. They have controls. Only tables and queries
have fields.
Good morning. I'm trying to figure out how to write a formula for a
calculated text field called Cost:

[quoted text clipped - 6 lines]
Thanks!
Lori


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200804/1


  #5  
Old April 21st, 2008, 03:07 PM posted to microsoft.public.access.forms
Lori2836 via AccessMonster.com
external usenet poster
 
Posts: 44
Default Formula Help in a calculated text field

Happy Monday Klatuu. I have tried your suggestion, but for some reason it
isn't working. When you say "current event", exactly what are you talking
about? I have tried to add it in several different areas as an event and I
think I may be putting it in the wrong place.

Thank you!
Lori



Klatuu wrote:
Please do,
You, too.
Mine starts in 15 minutes. Be Back Monday
Thanks Klatuu! I appreciate your help. If it doesn't work for some reason,
I'll let you know. Have a great weekend.

[quoted text clipped - 23 lines]
Thanks!
Lori


--
Message posted via http://www.accessmonster.com

  #6  
Old April 21st, 2008, 03:14 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Formula Help in a calculated text field

Open your form in design view.
Open the properties dialog and be sure it says Form in the box at the top
Select the Events tab
Click on the small button with the 3 dots just to the right of the On
Current box.
Select Code Builder
Put the code in there.
--
Dave Hargis, Microsoft Access MVP


"Lori2836 via AccessMonster.com" wrote:

Happy Monday Klatuu. I have tried your suggestion, but for some reason it
isn't working. When you say "current event", exactly what are you talking
about? I have tried to add it in several different areas as an event and I
think I may be putting it in the wrong place.

Thank you!
Lori



Klatuu wrote:
Please do,
You, too.
Mine starts in 15 minutes. Be Back Monday
Thanks Klatuu! I appreciate your help. If it doesn't work for some reason,
I'll let you know. Have a great weekend.

[quoted text clipped - 23 lines]
Thanks!
Lori


--
Message posted via http://www.accessmonster.com


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:14 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.